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
56f0de79
authored
Aug 28, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
PCB bug fixex (issue #542)
parent
1ad9f904
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
1745 deletions
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/CustomList.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/MainActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictoGridAdapter.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictoItemViewGenerator.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SplashScreenActivity.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/StudentFragmentGrid.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/TapeAdapter.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/action/UnsubscribeAction.java
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/CustomList.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.app.Activity
;
import
android.graphics.Bitmap
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ArrayAdapter
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.yottacode.pictogram.R
;
import
java.util.Vector
;
/**
* Creates a View for each student on the list with a photo and his/her name.
* It uses list_single.xml for the layout creation.
*/
public
class
CustomList
extends
ArrayAdapter
<
String
>{
private
final
Activity
context
;
private
final
String
[]
name_surname
;
private
final
Vector
<
Bitmap
>
images
;
/**
* @param context Context used for rendering the view
* @param name_surname List of students' names
* @param images List of students' photos
*/
public
CustomList
(
Activity
context
,
String
[]
name_surname
,
Vector
<
Bitmap
>
images
)
{
super
(
context
,
R
.
layout
.
list_single
,
name_surname
);
this
.
context
=
context
;
this
.
name_surname
=
name_surname
;
this
.
images
=
images
;
}
/**
* @param position Student position in the name_surname/images arrays
* @param view @TODO not being used
* @param parent @TODO not being used
* @return The rendered student view
*/
@Override
public
View
getView
(
int
position
,
View
view
,
ViewGroup
parent
)
{
LayoutInflater
inflater
=
context
.
getLayoutInflater
();
View
rowView
=
inflater
.
inflate
(
R
.
layout
.
list_single
,
null
,
true
);
TextView
txtTitle
=
(
TextView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentName
);
ImageView
imageView
=
(
ImageView
)
rowView
.
findViewById
(
R
.
id
.
loginStudentPhoto
);
txtTitle
.
setText
(
name_surname
[
position
]);
//imageView.setImageResource(R.drawable.user);
imageView
.
setImageBitmap
(
images
.
elementAt
(
position
));
return
rowView
;
}
}
\ No newline at end of file
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/LoginActivity.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.annotation.TargetApi
;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.support.v4.app.FragmentActivity
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.Window
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.net.ImgDownloader
;
import
com.yottacode.pictogram.net.iImgDownloaderListener
;
import
com.yottacode.pictogram.tools.Img
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
com.yottacode.tools.GUITools
;
import
java.io.IOException
;
import
java.util.Vector
;
/**
* LoginActivity show the login window to select the student and supervisor
* It uses device to read the token value
*/
public
class
LoginActivity
extends
FragmentActivity
{
// String constant for logs
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
/**
* If there is Internet connection it calls the WS to recover the pairs student-supervisor
* @param savedInstanceState
*/
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
activity_login
);
// Enable logout button
final
Button
logoutButton
=
(
Button
)
findViewById
(
R
.
id
.
loginTopbarLogout
);
logoutButton
.
setEnabled
(
true
);
logoutButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Intent
serialActivity
=
new
Intent
(
getBaseContext
(),
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"resetPrevUser"
,
true
);
startActivity
(
serialActivity
);
}
});
// Set supervisor information on topbar
final
TextView
supervisorFullNameView
=
(
TextView
)
findViewById
(
R
.
id
.
loginTopbarSupervisorFullName
);
final
TextView
supervisorUserNameView
=
(
TextView
)
findViewById
(
R
.
id
.
loginTopbarSupervisorUserName
);
final
ImageView
supervisorPhotoView
=
(
ImageView
)
findViewById
(
R
.
id
.
loginTopbarSupervisorPhoto
);
supervisorFullNameView
.
setText
(
this
.
getIntent
().
getStringExtra
(
"name"
)
+
" "
+
this
.
getIntent
().
getStringExtra
(
"surname"
));
supervisorUserNameView
.
setText
(
this
.
getIntent
().
getStringExtra
(
"email"
));
final
Vector
<
Img
>
imgs
=
new
Vector
<>(
1
);
imgs
.
add
(
new
Img
(
this
.
getIntent
().
getIntExtra
(
"sup_id"
,
-
1
),
this
.
getIntent
().
getStringExtra
(
"pic"
),
Img
.
SUPERVISOR
));
ImgDownloader
downloader
=
new
ImgDownloader
(
this
,
new
iImgDownloaderListener
()
{
@Override
public
void
loadComplete
()
{
try
{
supervisorPhotoView
.
setImageBitmap
(
imgs
.
get
(
0
).
get_bitmap
(
PCBcontext
.
getContext
())
);
supervisorPhotoView
.
invalidate
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
loadImg
(
Img
image
)
{}
@Override
public
void
error
(
Exception
e
)
{
GUITools
.
show_alert
(
PCBcontext
.
getContext
(),
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
},
ImgDownloader
.
tsource
.
remote
);
downloader
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
imgs
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/MainActivity.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.Toast
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.dao.Device
;
import
com.yottacode.pictogram.dao.LoginException
;
import
com.yottacode.pictogram.dao.PCBDBHelper
;
import
com.yottacode.pictogram.dao.User
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
org.json.JSONException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Vector
;
public
class
MainActivity
extends
Activity
{
// String constant for logs
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
// For deactivating the lock screen (just before setContentView)
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_DISMISS_KEYGUARD
);
PCBcontext
.
init
(
this
);
Log
.
d
(
LOG_TAG
,
"PCBcontext iniciado."
);
Intent
serialActivity
=
new
Intent
(
this
,
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"resetPrevUser"
,
false
);
startActivity
(
serialActivity
);
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
PCBcontext
.
getNetService
().
closeNotifyStatus
();
}
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater
().
inflate
(
R
.
menu
.
main
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
action_settings
)
{
return
true
;
}
return
super
.
onOptionsItemSelected
(
item
);
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictoGridAdapter.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.annotation.TargetApi
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.speech.tts.TextToSpeech
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ArrayAdapter
;
import
android.widget.FrameLayout
;
import
android.widget.GridView
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
java.io.IOException
;
import
java.util.LinkedList
;
public
class
PictoGridAdapter
extends
ArrayAdapter
{
private
LinkedList
<
Picto
>
pictoLinkedList
;
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
public
PictoGridAdapter
(
LinkedList
<
Picto
>
pictoLinkedList
){
super
(
PCBcontext
.
getContext
(),
PictoItemViewGenerator
.
LAYOUT
,
pictoLinkedList
);
this
.
pictoLinkedList
=
pictoLinkedList
;
}
@Override
public
int
getCount
()
{
return
this
.
pictoLinkedList
.
size
();
}
@Override
public
Picto
getItem
(
int
position
)
{
return
this
.
pictoLinkedList
.
get
(
position
);
}
@Override
public
long
getItemId
(
int
position
)
{
return
0
;
}
public
void
deleteAll
()
{
this
.
pictoLinkedList
.
clear
();
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
return
PictoItemViewGenerator
.
getPictoView
(
this
.
pictoLinkedList
.
get
(
position
),
convertView
,
parent
);
}
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
public
void
ttsPicto
(
Picto
p
,
TextToSpeech
tts
)
{
if
(
p
.
is_enabled
())
{
String
input
=
p
.
get_translation
();
Bundle
params
=
new
Bundle
();
params
.
putString
(
TextToSpeech
.
Engine
.
KEY_PARAM_VOLUME
,
"1"
);
tts
.
speak
(
input
,
TextToSpeech
.
QUEUE_FLUSH
,
params
,
null
);
}
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictoItemViewGenerator.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
java.io.IOException
;
/**
* This class is used for generating PictoViews which will be inserted inside a picto grid
* or a picto tape.
*/
public
class
PictoItemViewGenerator
{
public
static
final
int
LAYOUT
=
R
.
layout
.
picto_grid_item
;
public
static
View
getPictoView
(
Picto
picto
,
View
convertView
,
ViewGroup
parent
)
{
if
(
convertView
==
null
)
{
convertView
=
LayoutInflater
.
from
(
parent
.
getContext
()).
inflate
(
LAYOUT
,
parent
,
false
);
}
RelativeLayout
layoutWrapper
=
(
RelativeLayout
)
convertView
.
findViewById
(
R
.
id
.
picto_grid_item_layout_wrapper
);
FrameLayout
layout
=
(
FrameLayout
)
convertView
.
findViewById
(
R
.
id
.
picto_grid_item_layout
);
ImageView
pictoImage
=
(
ImageView
)
convertView
.
findViewById
(
R
.
id
.
picto_grid_item_image
);
ImageView
redCrossImage
=
(
ImageView
)
convertView
.
findViewById
(
R
.
id
.
picto_grid_item_redcross
);
layoutWrapper
.
setVisibility
(
View
.
GONE
);
layoutWrapper
.
setBackground
(
null
);
layoutWrapper
.
setAlpha
(
0.25f
);
layout
.
setBackgroundColor
(
convertView
.
getResources
()
.
getColor
(
R
.
color
.
picto_default_background
));
redCrossImage
.
setVisibility
(
View
.
GONE
);
pictoImage
.
setScaleX
(
1.0f
);
pictoImage
.
setScaleY
(
1.0f
);
pictoImage
.
setVisibility
(
View
.
GONE
);
if
(
picto
==
null
)
{
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
is_supervisor
())
{
layoutWrapper
.
setVisibility
(
View
.
VISIBLE
);
layoutWrapper
.
setBackground
(
convertView
.
getResources
()
.
getDrawable
(
R
.
drawable
.
picto_grid_item_border
));
}
}
else
{
if
(!
picto
.
is_invisible
()
&&
!
picto
.
is_disabled
())
{
layoutWrapper
.
setAlpha
(
1.00f
);
}
try
{
pictoImage
.
setImageBitmap
(
picto
.
get_bitmap
(
PCBcontext
.
getContext
()));
if
(!
picto
.
is_invisible
()
||
PCBcontext
.
getPcbdb
().
getCurrentUser
().
is_supervisor
())
{
layoutWrapper
.
setVisibility
(
View
.
VISIBLE
);
pictoImage
.
setVisibility
(
View
.
VISIBLE
);
layoutWrapper
.
setBackground
(
convertView
.
getResources
()
.
getDrawable
(
R
.
drawable
.
picto_grid_item_border
));
if
(
picto
.
is_magnify
())
{
pictoImage
.
setScaleX
(
1.2f
);
pictoImage
.
setScaleY
(
1.2f
);
}
if
(
picto
.
is_disabled
())
{
redCrossImage
.
setVisibility
(
View
.
VISIBLE
);
}
if
(
picto
.
is_category
())
{
layout
.
setBackgroundColor
(
picto
.
get_color
());
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
convertView
;
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/PictogramActivity.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.database.Cursor
;
import
android.content.ClipData
;
import
android.content.ClipDescription
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.provider.MediaStore
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.text.InputType
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.view.DragEvent
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.animation.AccelerateDecelerateInterpolator
;
import
android.view.animation.Animation
;
import
android.view.animation.TranslateAnimation
;
import
android.widget.AdapterView
;
import
android.widget.CheckBox
;
import
android.widget.EditText
;
import
android.widget.GridView
;
import
android.widget.ImageButton
;
import
android.widget.RelativeLayout
;
import
android.widget.Toast
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.action.PictosAction
;
import
com.yottacode.pictogram.action.TalkAction
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.grammar.Vocabulary
;
import
com.yottacode.pictogram.grammar.iLocalPicto
;
import
com.yottacode.pictogram.grammar.iVocabularyListener
;
import
com.yottacode.pictogram.net.PictoUploader
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Locale
;
public
class
PictogramActivity
extends
Activity
implements
iVocabularyListener
,
TextToSpeech
.
OnInitListener
{
// Main layout for this activity
RelativeLayout
mainLayout
;
// Adapter for de grid showing the categories grid (and main pictos)
PictoGridAdapter
pictoMainGridAdapter
;
// Grid showing the categories grid (and main pictos)
GridView
pictoMainGridView
;
// Adapter for the grid showing pictos from a category (initially hidden)
PictoGridAdapter
pictoCategoryGridAdapter
;
// Grid showing pictos from a category (initially hidden)
GridView
pictoCategoryGridView
;
// Adapter for the tape view (list of pictos to send to the server)
TapeAdapter
tapeAdapter
;
// Tape view (list of pictos to send to the server)
GridView
tapeGridView
;
// Current picto category, if not null the corresponding category grid will be shown
Picto
currentCategory
;
// Object used for reading text
TextToSpeech
tts
;
// Element used for loading new pictos (while changing categories)
Vocabulary
vocabulary
;
// TODO describe this variable
static
final
int
SELECT_PICTURE
=
1
;
// For disabling volume button (See method at the end of the class)
private
final
List
blockedKeys
=
new
ArrayList
(
Arrays
.
asList
(
KeyEvent
.
KEYCODE_VOLUME_DOWN
,
KeyEvent
.
KEYCODE_VOLUME_UP
));
// String constant for logs
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
// Count for delete long press (hidden exit)
private
int
count_deletelong
=
0
;
// Animation for hidding the picto category view
Animation
hidePictoMainViewAnimation
;
// Animation for showing the picto category view
Animation
showPictoMainViewAnimation
;
// Button used for showing the picto category view
ImageButton
showPictoCategoriesViewButton
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
activity_pictogram
);
this
.
mainLayout
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
pictogramLayout
);
this
.
currentCategory
=
null
;
this
.
count_deletelong
=
0
;
this
.
vocabulary
=
PCBcontext
.
getVocabulary
();
this
.
vocabulary
.
listen
(
PCBcontext
.
getRoom
(),
this
);
if
(
this
.
vocabulary
!=
null
&&
this
.
vocabulary
.
size
()
>
0
)
{
Log
.
d
(
LOG_TAG
,
"Vocabulario correcto de tam:"
+
vocabulary
.
size
());
}
this
.
tapeAdapter
=
new
TapeAdapter
();
this
.
tapeGridView
=
(
GridView
)
this
.
findViewById
(
R
.
id
.
tape_grid_view
);
this
.
tapeGridView
.
setAdapter
(
this
.
tapeAdapter
);
this
.
pictoMainGridAdapter
=
new
PictoGridAdapter
(
new
LinkedList
<
Picto
>());
this
.
pictoMainGridView
=
(
GridView
)
this
.
findViewById
(
R
.
id
.
picto_main_grid_view
);
this
.
pictoMainGridView
.
setAdapter
(
this
.
pictoMainGridAdapter
);
this
.
pictoCategoryGridAdapter
=
new
PictoGridAdapter
(
new
LinkedList
<
Picto
>());
this
.
pictoCategoryGridView
=
(
GridView
)
this
.
findViewById
(
R
.
id
.
picto_category_grid_view
);
this
.
pictoCategoryGridView
.
setAdapter
(
this
.
pictoCategoryGridAdapter
);
// @TODO take this value from user configuration (0: normal, 1: large)
int
pictogramSize
=
0
;
if
(
pictogramSize
==
0
)
{
this
.
pictoMainGridView
.
setNumColumns
(
10
);
this
.
pictoCategoryGridView
.
setNumColumns
(
10
);
}
else
if
(
pictogramSize
==
1
)
{
this
.
pictoMainGridView
.
setNumColumns
(
4
);
this
.
pictoCategoryGridView
.
setNumColumns
(
4
);
}
// tts = new TextToSpeech(this, this, "IVONA Text-to-Speech HQ");
tts
=
new
TextToSpeech
(
this
,
this
);
tts
.
setOnUtteranceProgressListener
(
new
OnTTSEndListener
());
this
.
tapeGridView
.
setOnDragListener
(
new
OnPictoDragListener
());
this
.
pictoMainGridView
.
setOnDragListener
(
new
OnPictoDragListener
());
this
.
pictoCategoryGridView
.
setOnDragListener
(
new
OnPictoDragListener
());
this
.
pictoMainGridView
.
setOnItemClickListener
(
new
OnPictoClickListener
());
this
.
pictoCategoryGridView
.
setOnItemClickListener
(
new
OnPictoClickListener
());
this
.
pictoMainGridView
.
setOnItemLongClickListener
(
new
OnPictoLongClickListener
());
this
.
pictoCategoryGridView
.
setOnItemLongClickListener
(
new
OnPictoLongClickListener
());
final
ImageButton
deleteButton
=
(
ImageButton
)
findViewById
(
R
.
id
.
button_delete
);
final
ImageButton
ttsButton
=
(
ImageButton
)
findViewById
(
R
.
id
.
button_tts
);
ttsButton
.
setOnClickListener
(
new
OnTTSButtonClickListener
());
deleteButton
.
setOnClickListener
(
new
OnDeleteButtonClickListener
());
deleteButton
.
setOnLongClickListener
(
new
OnDeleteButtonLongClickListener
());
this
.
showPictoCategoriesViewButton
=
(
ImageButton
)
this
.
findViewById
(
R
.
id
.
showPictoCategoriesViewButton
);
this
.
showPictoCategoriesViewButton
.
setOnClickListener
(
new
OnShowPictoCategoriesViewButtonClick
());
this
.
generateAnimations
();
if
(
this
.
currentCategory
!=
null
)
{
this
.
hidePictoMainGridView
();
}
else
{
this
.
showPictoMainGridView
();
}
}
@Override
public
void
onInit
(
int
status
)
{
if
(
status
==
TextToSpeech
.
SUCCESS
)
{
tts
.
setLanguage
(
Locale
.
getDefault
());
}
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
if
(
tts
!=
null
){
tts
.
shutdown
();
}
// PCBcontext.getNetService().closeNotifyStatus();
}
/**
* Creates the animations for moving the picto view
*/
private
void
generateAnimations
()
{
DisplayMetrics
displayMetrics
=
new
DisplayMetrics
();
this
.
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
int
animationDuration
=
400
;
int
animationWidth
=
displayMetrics
.
widthPixels
;
this
.
hidePictoMainViewAnimation
=
new
TranslateAnimation
(
0
,
-
animationWidth
,
0
,
0
);
this
.
hidePictoMainViewAnimation
.
setDuration
(
animationDuration
);
this
.
hidePictoMainViewAnimation
.
setFillAfter
(
true
);
this
.
hidePictoMainViewAnimation
.
setInterpolator
(
new
AccelerateDecelerateInterpolator
());
this
.
hidePictoMainViewAnimation
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
@Override
public
void
onAnimationStart
(
Animation
animation
)
{}
@Override
public
void
onAnimationEnd
(
Animation
animation
)
{
pictoMainGridView
.
setTranslationZ
(-
1000.0f
);
pictoMainGridView
.
setVisibility
(
View
.
GONE
);
}
@Override
public
void
onAnimationRepeat
(
Animation
animation
)
{}
});
this
.
showPictoMainViewAnimation
=
new
TranslateAnimation
(-
animationWidth
,
0
,
0
,
0
);
this
.
showPictoMainViewAnimation
.
setDuration
(
animationDuration
);
this
.
showPictoMainViewAnimation
.
setFillAfter
(
true
);
this
.
showPictoMainViewAnimation
.
setInterpolator
(
new
AccelerateDecelerateInterpolator
());
this
.
showPictoMainViewAnimation
.
setAnimationListener
(
new
Animation
.
AnimationListener
()
{
@Override
public
void
onAnimationStart
(
Animation
animation
)
{
pictoMainGridView
.
setTranslationZ
(
1000.0f
);
pictoMainGridView
.
setVisibility
(
View
.
VISIBLE
);
}
@Override
public
void
onAnimationEnd
(
Animation
animation
)
{}
@Override
public
void
onAnimationRepeat
(
Animation
animation
)
{}
});
}
/**
* Show the main category grid view and hide the pictoGrid, unloading all pictos
* if necesary.
*/
private
void
showPictoMainGridView
()
{
Log
.
d
(
LOG_TAG
,
"Showing pictoMainGridView"
);
this
.
pictoMainGridAdapter
.
clear
();
this
.
pictoMainGridAdapter
.
addAll
(
this
.
sort
(
this
.
vocabulary
.
startSentence
()));
this
.
pictoMainGridAdapter
.
notifyDataSetChanged
();
this
.
pictoMainGridView
.
setEnabled
(
true
);
this
.
pictoCategoryGridView
.
setEnabled
(
false
);
if
(
this
.
pictoMainGridView
.
getAnimation
()
==
this
.
hidePictoMainViewAnimation
)
{
this
.
pictoMainGridView
.
startAnimation
(
this
.
showPictoMainViewAnimation
);
}
this
.
currentCategory
=
null
;
}
/**
* Hides the main category grid view and show a concrete category (this.currentCategory)
*/
private
void
hidePictoMainGridView
()
{
Log
.
d
(
LOG_TAG
,
"Hiding pictoMainGridView"
);
this
.
pictoCategoryGridAdapter
.
clear
();
this
.
pictoCategoryGridAdapter
.
addAll
(
this
.
sort
(
this
.
vocabulary
.
next
(
this
.
currentCategory
)));
this
.
pictoCategoryGridAdapter
.
notifyDataSetChanged
();
if
(
this
.
currentCategory
.
get_color
()
!=
-
1
)
{
this
.
pictoCategoryGridView
.
setBackgroundColor
(
this
.
currentCategory
.
get_color
());
}
this
.
pictoMainGridView
.
setEnabled
(
false
);
this
.
pictoCategoryGridView
.
setEnabled
(
true
);
if
(
this
.
pictoMainGridView
.
getAnimation
()
!=
this
.
hidePictoMainViewAnimation
)
{
this
.
pictoMainGridView
.
startAnimation
(
this
.
hidePictoMainViewAnimation
);
}
}
/**
* Returns pictoCategoryGridAdapter or pictoMainGridAdapter depending on the current View
*/
private
PictoGridAdapter
getCurrentPictoGridAdapter
()
{
return
(
currentCategory
==
null
)
?
this
.
pictoMainGridAdapter
:
this
.
pictoCategoryGridAdapter
;
}
/**
* Order a linked list of pictos with "blank spaces" between them
* @param list
* @return
*/
public
LinkedList
<
Picto
>
sort
(
LinkedList
<
Picto
>
list
){
if
(
list
==
null
)
{
list
=
new
LinkedList
<>();
}
LinkedList
<
Picto
>
ll
=
new
LinkedList
<>();
// This is to show the pictos ordered in the 2D Array that represents the panel
int
rows
=
getResources
().
getInteger
(
R
.
integer
.
rows
);
int
cols
=
getResources
().
getInteger
(
R
.
integer
.
columns
);
Picto
[][]
mp
=
new
Picto
[
rows
][
cols
];
for
(
Picto
p
:
list
)
{
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
has_categories
())
{
if
(
p
.
get_column
()
!=
-
1
&&
p
.
get_row
()
!=
-
1
)
{
mp
[
p
.
get_column
()][
p
.
get_row
()]
=
p
;
}
}
else
{
if
(
p
.
getFreeColumn
()
!=
-
1
&&
p
.
getFreeRow
()
!=
-
1
)
{
mp
[
p
.
getFreeColumn
()][
p
.
getFreeRow
()]
=
p
;
}
}
}
try
{
/*
Picto blankPicto = new Picto(0,
"/symbolstx/color/png/arts_crafts/eraser.png", // TODO Definir imagen para picto en blanco
"Blank picto",
"{\"magnify\":false,\"highlight\":false,\"coord_y\":1,\"id_cat\":12303,\"status\":\"invisible\",\"coord_x\":4}");
*/
for
(
int
i
=
0
;
i
<
rows
;
i
++){
for
(
int
j
=
0
;
j
<
cols
;
j
++){
if
(
mp
[
i
][
j
]
!=
null
)
ll
.
add
(
mp
[
i
][
j
]);
else
ll
.
add
(
null
);
// Add the "blank picto" simulating an empty position
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ll
;
}
/**
* Background task that updates the ui into the main thread
*/
public
void
refresh
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
currentCategory
!=
null
)
{
hidePictoMainGridView
();
}
else
{
showPictoMainGridView
();
}
}
});
}
/**
* @TODO check documentation
* De la interfaz iVocabularyListener
*/
@Override
public
void
change
(
action
action
,
int
picto_cat
,
int
picto_id
,
JSONObject
args
)
{
Log
.
d
(
LOG_TAG
,
"Vocabulary action listened: "
+
action
);
if
(
args
!=
null
)
Log
.
d
(
LOG_TAG
,
"args: "
+
args
.
toString
());
refresh
();
}
/**
* Disable Back Button --> Kiosk mode
*/
@Override
public
void
onBackPressed
()
{
// Inflate the layout for the AlertDialog
View
dialogEscape
=
View
.
inflate
(
this
,
R
.
layout
.
dialog_escape
,
null
);
final
CheckBox
checkBox
=
(
CheckBox
)
dialogEscape
.
findViewById
(
R
.
id
.
checkBox
);
final
EditText
input
=
(
EditText
)
dialogEscape
.
findViewById
(
R
.
id
.
editText
);
// Build de AlertDialog
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
getResources
().
getString
(
R
.
string
.
exitPictogram
));
builder
.
setView
(
dialogEscape
);
// Set up the buttons
builder
.
setPositiveButton
(
getResources
().
getString
(
R
.
string
.
ok
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
String
m_Text
=
input
.
getText
().
toString
();
String
keyword
=
PCBcontext
.
getDevice
().
getKeyword
();
if
(
m_Text
.
equalsIgnoreCase
(
keyword
))
{
// Change the password
if
(
checkBox
.
isChecked
()){
// Show a new dialog
View
dialogChangeEscapeCode
=
View
.
inflate
(
PCBcontext
.
getContext
(),
R
.
layout
.
dialog_change_escape_code
,
null
);
final
EditText
input1
=
(
EditText
)
dialogChangeEscapeCode
.
findViewById
(
R
.
id
.
editText1
);
final
EditText
input2
=
(
EditText
)
dialogChangeEscapeCode
.
findViewById
(
R
.
id
.
editText2
);
// Build the AlertDialog
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
PCBcontext
.
getContext
());
builder
.
setTitle
(
PCBcontext
.
getContext
().
getResources
().
getString
(
R
.
string
.
newEscapeCode
));
builder
.
setView
(
dialogChangeEscapeCode
);
// Set up the buttons
builder
.
setPositiveButton
(
getResources
().
getString
(
R
.
string
.
ok
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
// Retrieve the text of the 2 password inputs
String
m_Text1
=
input1
.
getText
().
toString
();
String
m_Text2
=
input2
.
getText
().
toString
();
// If they are equal
if
(
m_Text1
.
equalsIgnoreCase
(
m_Text2
))
{
// Change the keyword
PCBcontext
.
getDevice
().
setKeyword
(
m_Text1
);
Toast
.
makeText
(
PCBcontext
.
getContext
(),
getResources
().
getString
(
R
.
string
.
codeModified
),
Toast
.
LENGTH_SHORT
).
show
();
// And exit PictogramActivity
finish
();
}
else
Toast
.
makeText
(
PCBcontext
.
getContext
(),
getResources
().
getString
(
R
.
string
.
codesNotEqual
),
Toast
.
LENGTH_SHORT
).
show
();
}
});
builder
.
setNegativeButton
(
getResources
().
getString
(
R
.
string
.
cancel
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
cancel
();
}
});
builder
.
show
();
}
else
{
// Finish this Activity it the code is ok and is not checked the checkbox to change the code
finish
();
/*
// Start the main activity
Intent mainActivity = new Intent(context, MainActivity.class);
startActivity(mainActivity);
*/
}
// Wrong code
}
else
Toast
.
makeText
(
PCBcontext
.
getContext
(),
getResources
().
getString
(
R
.
string
.
wrongCode
),
Toast
.
LENGTH_SHORT
).
show
();
}
});
builder
.
setNegativeButton
(
getResources
().
getString
(
R
.
string
.
cancel
),
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
dialog
.
cancel
();
}
});
builder
.
show
();
}
/**
* Disable long power button press (system menu)
* @param hasFocus
*/
@Override
public
void
onWindowFocusChanged
(
boolean
hasFocus
)
{
super
.
onWindowFocusChanged
(
hasFocus
);
if
(!
hasFocus
)
{
// Close every kind of system dialog
Intent
closeDialog
=
new
Intent
(
Intent
.
ACTION_CLOSE_SYSTEM_DIALOGS
);
sendBroadcast
(
closeDialog
);
}
}
/**
* Disable volume button on key event
* @param event
*/
@Override
public
boolean
dispatchKeyEvent
(
KeyEvent
event
)
{
if
(
blockedKeys
.
contains
(
event
.
getKeyCode
()))
{
return
true
;
}
else
{
return
super
.
dispatchKeyEvent
(
event
);
}
}
/* *********************************************************************************************
* Event listener classes
* ********************************************************************************************/
/**
* Class used for dragging pictos to the tape
*/
private
class
OnPictoDragListener
implements
View
.
OnDragListener
{
//Drawable normalShape = getResources().getDrawable(R.drawable.normal_shape);
//Drawable targetShape = getResources().getDrawable(R.drawable.target_shape);
@Override
public
boolean
onDrag
(
View
v
,
DragEvent
event
)
{
// Handles each of the expected events
switch
(
event
.
getAction
())
{
//signal for the start of a drag and drop operation.
case
DragEvent
.
ACTION_DRAG_STARTED
:
// do nothing
Log
.
d
(
"Drag:"
,
"1 Drag started"
);
break
;
//the drag point has entered the bounding box of the View
case
DragEvent
.
ACTION_DRAG_ENTERED
:
//v.setBackground(targetShape); //change the shape of the view
Log
.
d
(
"Drag:"
,
"2 Drag entered"
);
break
;
//the user has moved the drag shadow outside the bounding box of the View
case
DragEvent
.
ACTION_DRAG_EXITED
:
//v.setBackground(normalShape); //change the shape of the view back to normal
Log
.
d
(
"Drag:"
,
"3 Drag exited"
);
break
;
//drag shadow has been released,the drag point is within the bounding box of the View
case
DragEvent
.
ACTION_DROP
:
Log
.
d
(
"Drag:"
,
"4 Drop"
);
View
view
=
(
View
)
event
.
getLocalState
();
ViewGroup
viewgroup
=
(
ViewGroup
)
view
.
getParent
();
int
position
=
Integer
.
parseInt
((
String
)
event
.
getClipDescription
().
getLabel
());
// if the view is the tape_grid_view, we accept the drag item
// Destino tape_grid_view y origen panel_grid_view
if
(
v
==
findViewById
(
R
.
id
.
tape_grid_view
)
&&
viewgroup
==
findViewById
(
R
.
id
.
picto_category_grid_view
))
{
Log
.
d
(
"Drag:"
,
"Posición: "
+
position
);
Picto
p
=
pictoCategoryGridAdapter
.
getItem
(
position
);
if
(!
p
.
is_category
())
{
currentCategory
=
null
;
tapeAdapter
.
addItem
(
p
);
tapeAdapter
.
notifyDataSetChanged
();
showPictoMainGridView
();
PCBcontext
.
getActionLog
().
log
(
new
TalkAction
(
TalkAction
.
ADD
,
p
));
}
}
// Si el destino es el panel y el origen la cinta de frase
else
if
(
v
==
findViewById
(
R
.
id
.
picto_category_grid_view
)
&&
viewgroup
==
findViewById
(
R
.
id
.
tape_grid_view
)){
Log
.
d
(
"Drag:"
,
"Posición: "
+
position
);
Picto
p
=
tapeAdapter
.
getItem
(
position
);
tapeAdapter
.
deleteItem
(
position
);
tapeAdapter
.
notifyDataSetChanged
();
}
break
;
//the drag and drop operation has concluded.
case
DragEvent
.
ACTION_DRAG_ENDED
:
Log
.
d
(
"Drag:"
,
"5 Drag ended"
);
// v.setBackground(normalShape); //go back to normal shape
default
:
break
;
}
return
true
;
}
}
/**
* Class used for picto clicking feedback
*/
private
class
OnPictoClickListener
implements
AdapterView
.
OnItemClickListener
{
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
Picto
p
=
getCurrentPictoGridAdapter
().
getItem
(
position
);
if
(
p
!=
null
&&
!
p
.
is_invisible
()
&&
p
.
is_enabled
())
{
Log
.
d
(
LOG_TAG
,
"Clic en picto: "
+
p
.
toString
());
//Log.d(LOG_TAG, "STATUS: " + p.get_status());
//QUITAR PARA QUE HABLE pictoCategoryGridAdapter.ttsPicto(p, tts);
// If is not the blank picto, it isn't invisible or disabled
if
(
p
.
get_id
()
!=
0
&&
!
p
.
get_status
().
equalsIgnoreCase
(
"invisible"
)
&&
!
p
.
get_status
().
equalsIgnoreCase
(
"disabled"
))
{
LinkedList
<
Picto
>
ll
=
sort
(
PCBcontext
.
getVocabulary
().
next
(
p
));
//LinkedList<Picto> ll = vocabulary.next(p);
Log
.
d
(
LOG_TAG
,
"Lista de pictos recuperada: "
+
ll
.
toString
());
int
maxInTape
=
getResources
().
getInteger
(
R
.
integer
.
maxInTape
);
// If the picto is a category
if
(
p
.
is_category
())
{
currentCategory
=
p
;
PCBcontext
.
getActionLog
().
log
(
new
TalkAction
(
TalkAction
.
SELECT
,
p
));
hidePictoMainGridView
();
}
else
if
(
tapeAdapter
.
getCount
()
<
maxInTape
)
{
currentCategory
=
null
;
tapeAdapter
.
addItem
(
p
);
tapeAdapter
.
notifyDataSetChanged
();
PCBcontext
.
getActionLog
().
log
(
new
TalkAction
(
TalkAction
.
ADD
,
p
));
showPictoMainGridView
();
}
}
}
}
}
/**
* Class used for long pressing on pictos (start drag)
*/
private
class
OnPictoLongClickListener
implements
AdapterView
.
OnItemLongClickListener
{
public
boolean
onItemLongClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
is_supervisor
())
{
// Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
Picto
p
=
getCurrentPictoGridAdapter
().
getItem
(
position
);
if
(
p
==
null
)
{
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if
(
currentCategory
!=
null
||
!
PCBcontext
.
getPcbdb
().
getCurrentUser
().
has_categories
())
{
Log
.
d
(
LOG_TAG
,
"No tengo pictograma. Abro carrete..."
);
int
cols
=
getResources
().
getInteger
(
R
.
integer
.
columns
);
addPicto
(
position
%
cols
,
(
int
)
(
position
/
cols
));
}
else
Toast
.
makeText
(
PictogramActivity
.
this
,
PictogramActivity
.
this
.
getResources
().
getString
(
R
.
string
.
notNewCats
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
p
.
alter_status
();
getCurrentPictoGridAdapter
().
notifyDataSetChanged
();
}
}
else
{
ClipData
.
Item
item
=
new
ClipData
.
Item
(
""
+
position
);
String
[]
mimeTypes
=
{
ClipDescription
.
MIMETYPE_TEXT_PLAIN
};
ClipData
data
=
new
ClipData
(
""
+
position
,
mimeTypes
,
item
);
Picto
p
=
getCurrentPictoGridAdapter
().
getItem
(
position
);
if
(
p
!=
null
&&
!
p
.
is_invisible
()
&&
p
.
is_enabled
())
{
// If is not the blank picto, it isn't invisible or disabled
if
(
p
.
get_id
()
!=
0
&&
!
p
.
get_status
().
equalsIgnoreCase
(
"invisible"
)
&&
!
p
.
get_status
().
equalsIgnoreCase
(
"disabled"
)
&&
tapeAdapter
.
getCount
()
<
8
)
{
View
.
DragShadowBuilder
shadowBuilder
=
new
View
.
DragShadowBuilder
(
view
);
view
.
startDrag
(
data
,
//data to be dragged
shadowBuilder
,
//drag shadow
view
,
//local data about the drag and drop operation
0
//no needed flags
);
//view.setVisibility(View.INVISIBLE);
}
}
}
return
true
;
}
}
/**
* Class used for reading pictos on TTS button click
*/
private
class
OnTTSButtonClickListener
implements
View
.
OnClickListener
{
@Override
public
void
onClick
(
View
arg0
)
{
LinkedList
<
Picto
>
lp
=
tapeAdapter
.
getAll
();
PCBcontext
.
getActionLog
().
log
(
new
PictosAction
(
lp
));
tapeAdapter
.
ttsAllNew
(
tts
);
}
}
/**
* Class for listening the TTS start/end/error events.
* It clears the tape and shows the category grid when the speech has finished or errored.
*/
private
class
OnTTSEndListener
extends
UtteranceProgressListener
{
@Override
public
void
onStart
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read start"
);
}
@Override
public
void
onDone
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read end"
);
this
.
finishSpeech
();
}
@Override
public
void
onError
(
String
utteranceId
)
{
Log
.
d
(
LOG_TAG
,
"TTS tape read error"
);
this
.
finishSpeech
();
}
private
void
finishSpeech
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
tapeAdapter
.
deleteAll
();
tapeAdapter
.
notifyDataSetChanged
();
showPictoMainGridView
();
}
});
}
}
/**
* Class used for canceling a list of pictos on the tape
*/
private
class
OnDeleteButtonClickListener
implements
View
.
OnClickListener
{
@Override
public
void
onClick
(
View
arg0
)
{
if
(
tapeAdapter
.
hasElements
())
{
Picto
p
=
tapeAdapter
.
getLastItem
();
// Call to static log method
PCBcontext
.
getActionLog
().
log
(
new
TalkAction
(
TalkAction
.
DELETE
,
p
));
// Send websocket action
tapeAdapter
.
deleteLastView
();
tapeAdapter
.
notifyDataSetChanged
();
}
}
}
/**
* Class used for long click on delete button. When a press count reaches 3, the application
* exists.
*/
private
class
OnDeleteButtonLongClickListener
implements
View
.
OnLongClickListener
{
@Override
public
boolean
onLongClick
(
View
v
)
{
count_deletelong
++;
if
(
count_deletelong
>=
3
)
{
PCBcontext
.
unset_user
();
// Paso un parámetro a la SerialActivity, para controlar de dónde viene
Intent
serialActivity
=
new
Intent
(
getBaseContext
(),
SerialActivity
.
class
);
serialActivity
.
putExtra
(
"resetPrevUser"
,
true
);
startActivity
(
serialActivity
);
}
return
false
;
}
}
/**
* Listener used for bringing back the picto categories grid when clicked.
*/
private
class
OnShowPictoCategoriesViewButtonClick
implements
View
.
OnClickListener
{
@Override
public
void
onClick
(
View
v
)
{
showPictoMainGridView
();
}
}
/* *********************************************************************************************
* Methods for adding a new picto from pcb
* ********************************************************************************************/
/**
* add a local picto from pcb
* @param row
* @param col
*/
public
void
addPicto
(
int
row
,
int
col
)
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_PICK
);
intent
.
setType
(
"image/*"
);
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
has_categories
())
{
this
.
getIntent
().
putExtra
(
Picto
.
JSON_ATTTRS
.
ROW
,
row
);
this
.
getIntent
().
putExtra
(
Picto
.
JSON_ATTTRS
.
COLUMN
,
col
);
}
else
{
this
.
getIntent
().
putExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
row
);
this
.
getIntent
().
putExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
col
);
}
startActivityForResult
(
intent
,
SELECT_PICTURE
);
}
/**
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/
public
void
chooseTextAndSavePicto
(
final
String
selectedImagePath
,
final
int
row
,
final
int
col
,
final
int
freeRow
,
final
int
freeColumn
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
this
);
builder
.
setTitle
(
getResources
().
getString
(
R
.
string
.
enterImgLabel
));
// Set up the input
final
EditText
input
=
new
EditText
(
this
);
input
.
setInputType
(
InputType
.
TYPE_CLASS_TEXT
);
builder
.
setView
(
input
);
// Set up the buttons
builder
.
setPositiveButton
(
"OK"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
int
cat
=
PictogramActivity
.
this
.
currentCategory
!=
null
?
PictogramActivity
.
this
.
currentCategory
.
get_id
()
:
Picto
.
NO_CATEGORY
;
PCBcontext
.
getVocabulary
().
saveLocalPicto
(
selectedImagePath
,
input
.
getText
().
toString
(),
cat
,
row
,
col
,
freeRow
,
freeColumn
,
new
iLocalPicto
()
{
@Override
public
void
saved
(
Picto
localPicto
)
{
PictogramActivity
.
this
.
refresh
();
try
{
new
PictoUploader
(
localPicto
).
upload
(
PictogramActivity
.
this
);
}
catch
(
IOException
e
)
{
Log
.
e
(
Vocabulary
.
class
.
getCanonicalName
(),
e
.
getMessage
());
}
}
});
}
});
builder
.
show
();
}
/**
* Función para la selección de una foto del carrete
* @param requestCode
* @param resultCode
* @param data
*/
public
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
if
(
resultCode
==
Activity
.
RESULT_OK
)
{
if
(
requestCode
==
SELECT_PICTURE
)
{
String
selectedImagePath
;
Uri
selectedImageUri
=
data
.
getData
();
selectedImagePath
=
getPath
(
selectedImageUri
);
int
row
=
this
.
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
ROW
,
-
1
);
int
col
=
this
.
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
COLUMN
,
-
1
);
int
freeRow
=
this
.
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeColumn
=
this
.
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"0 Picto x y "
+
" "
+
row
+
" "
+
col
);
this
.
getIntent
().
removeExtra
(
Picto
.
JSON_ATTTRS
.
ROW
);
this
.
getIntent
().
removeExtra
(
Picto
.
JSON_ATTTRS
.
COLUMN
);
this
.
getIntent
().
removeExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
);
this
.
getIntent
().
removeExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
);
chooseTextAndSavePicto
(
selectedImagePath
,
row
,
col
,
freeRow
,
freeColumn
);
}
}
}
/**
* Función para la selección de una foto del carrete
* @param uri
* @return
*/
static
public
String
getPath
(
Uri
uri
)
{
if
(
uri
==
null
)
{
return
null
;
}
// this will only work for images selected from gallery
String
[]
projection
=
{
MediaStore
.
Images
.
Media
.
DATA
};
Cursor
cursor
=
PCBcontext
.
getContext
().
getContentResolver
().
query
(
uri
,
projection
,
null
,
null
,
null
);
if
(
cursor
!=
null
){
int
column_index
=
cursor
.
getColumnIndexOrThrow
(
MediaStore
.
Images
.
Media
.
DATA
);
cursor
.
moveToFirst
();
return
cursor
.
getString
(
column_index
);
}
return
uri
.
getPath
();
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/SplashScreenActivity.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.content.pm.ActivityInfo
;
import
android.os.Bundle
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
com.yottacode.pictogram.R
;
public
class
SplashScreenActivity
extends
Activity
{
// Set the duration of the splash screen
private
static
final
long
SPLASH_SCREEN_DELAY
=
3000
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
// Set landscape orientation
setRequestedOrientation
(
ActivityInfo
.
SCREEN_ORIENTATION_LANDSCAPE
);
// Hide title bar
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
setContentView
(
R
.
layout
.
activity_splash_screen
);
TimerTask
task
=
new
TimerTask
()
{
@Override
public
void
run
()
{
// Start the next activity
Intent
mainIntent
=
new
Intent
().
setClass
(
SplashScreenActivity
.
this
,
MainActivity
.
class
);
startActivity
(
mainIntent
);
// Intent pictogramActivity = new Intent().setClass(
// SplashScreenActivity.this, PictogramActivity.class);
//pictogramActivity.putExtra();
// seguir: hay que pasarle el estudiante y el supervisor, para cargar la colección, etc...
// startActivity(pictogramActivity);
// Close the activity so the user won't able to go back this
// activity pressing Back button
finish
();
}
};
// Simulate a long loading process on application startup.
Timer
timer
=
new
Timer
();
timer
.
schedule
(
task
,
SPLASH_SCREEN_DELAY
);
}
}
\ No newline at end of file
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/StudentFragmentGrid.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Vector
;
import
java.util.zip.Inflater
;
import
android.app.Fragment
;
import
android.app.ProgressDialog
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.AdapterView
;
import
android.widget.GridView
;
import
com.yottacode.net.RestapiWrapper
;
import
com.yottacode.net.iRestapiListener
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.dao.LoginException
;
import
com.yottacode.pictogram.dao.User
;
import
com.yottacode.pictogram.net.ImgDownloader
;
import
com.yottacode.pictogram.net.iImgDownloaderListener
;
import
com.yottacode.pictogram.tools.Img
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
com.yottacode.tools.GUITools
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* StudentFragmentGrid implements the gridview with the students
* @author Miguel Ángel García Cumbreras
* @author Fernando
* @version 1.1
*/
public
class
StudentFragmentGrid
extends
Fragment
{
final
String
TAG_ID
=
"id"
;
final
String
TAG_USERNAME
=
"username"
;
final
String
TAG_NAME
=
"name"
;
final
String
TAG_SURNAME
=
"surname"
;
final
String
TAG_GENDER
=
"gender"
;
final
String
TAG_PIC
=
"pic"
;
final
String
TAG_LANG
=
"lang"
;
final
String
TAG_ATTRIBUTES
=
"attributes"
;
final
String
TAG_SUPERVISION
=
"supervision"
;
Vector
<
Integer
>
idStudents
;
String
nameStudents
[];
Vector
<
Bitmap
>
imageStudents
;
private
Vector
<
JSONObject
>
downloaded_students
;
private
final
String
LOG_TAG
=
this
.
getClass
().
getSimpleName
();
// Or .getCanonicalName()
GridView
gridView
;
boolean
onlineStudentsOK
=
false
;
private
void
showStudentsGrid
(){
CustomList
adapter
=
new
CustomList
(
getActivity
(),
nameStudents
,
imageStudents
);
gridView
.
setAdapter
(
adapter
);
gridView
.
setOnItemClickListener
(
new
AdapterView
.
OnItemClickListener
()
{
@Override
public
void
onItemClick
(
AdapterView
<?>
arg0
,
View
arg1
,
int
pos
,
long
arg3
)
{
set_user
(
pos
);
}
});
}
private
void
set_user
(
int
i
)
{
Boolean
offline
=
getActivity
().
getIntent
().
getBooleanExtra
(
"offline"
,
false
);
if
(
offline
)
{
User
currentUser
=
null
;
try
{
currentUser
=
PCBcontext
.
getDevice
().
findUser
(
idStudents
.
get
(
i
),
getActivity
().
getIntent
().
getIntExtra
(
"sup_id"
,
0
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
PCBcontext
.
set_user
(
currentUser
,
null
,
null
);
Intent
pictogramActivity
=
new
Intent
(
getActivity
(),
PictogramActivity
.
class
);
startActivity
(
pictogramActivity
);
}
else
new_user
(
i
);
}
private
void
new_user
(
int
i
)
{
JSONObject
st
=
this
.
downloaded_students
.
get
(
i
);
Intent
intent
=
getActivity
().
getIntent
();
try
{
User
new_user
=
new
User
(
st
.
getInt
(
TAG_ID
),
st
.
getString
(
TAG_USERNAME
),
null
,
st
.
getString
(
TAG_NAME
),
st
.
getString
(
TAG_SURNAME
),
st
.
getString
(
TAG_PIC
),
st
.
getString
(
TAG_GENDER
),
st
.
getString
(
TAG_LANG
),
st
.
getString
(
TAG_ATTRIBUTES
),
intent
.
getIntExtra
(
"sup_id"
,
0
),
intent
.
getStringExtra
(
"email"
),
intent
.
getStringExtra
(
"password"
),
intent
.
getStringExtra
(
"name"
),
intent
.
getStringExtra
(
"surname"
),
intent
.
getStringExtra
(
"pic"
),
intent
.
getStringExtra
(
"gender"
),
intent
.
getStringExtra
(
"lang"
),
""
);
PCBcontext
.
getDevice
().
insertUser
(
new_user
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Loading vocabulary for "
+
new_user
.
get_name_stu
());
final
ProgressDialog
progressDialog
=
ProgressDialog
.
show
(
getActivity
(),
getString
(
R
.
string
.
loadingGrammar
),
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
PCBcontext
.
set_user
(
new_user
,
intent
.
getStringExtra
(
"token"
),
new
iImgDownloaderListener
()
{
@Override
public
void
loadComplete
()
{
progressDialog
.
dismiss
();
Intent
pictogramActivity
=
new
Intent
(
getActivity
(),
PictogramActivity
.
class
);
startActivity
(
pictogramActivity
);
}
@Override
public
void
loadImg
(
Img
image
)
{
}
public
void
error
(
Exception
e
)
{
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
StudentFragmentGrid
.
this
.
getActivity
(),
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
});
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
}
private
void
show_student_list_online
()
{
final
Vector
<
Img
>
imgs
=
new
Vector
<>(
downloaded_students
.
size
());
this
.
nameStudents
=
new
String
[
downloaded_students
.
size
()];
this
.
idStudents
=
new
Vector
<>(
downloaded_students
.
size
());
this
.
imageStudents
=
new
Vector
<>(
downloaded_students
.
size
());
for
(
int
i
=
0
;
i
<
downloaded_students
.
size
();
i
++)
{
JSONObject
st
;
try
{
st
=
downloaded_students
.
get
(
i
);
Integer
st_id
=
st
.
getInt
(
TAG_ID
);
String
st_name
=
st
.
getString
(
TAG_NAME
);
String
st_pic
=
st
.
getString
(
TAG_PIC
);
nameStudents
[
i
]=
st_name
;
idStudents
.
add
(
st_id
);
imgs
.
add
(
new
Img
(
st_id
,
st_pic
,
Img
.
STUDENT
));
//it's required to download student's images
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
}
//for
final
ProgressDialog
progressDialog
=
ProgressDialog
.
show
(
getActivity
(),
getString
(
R
.
string
.
imguserLoadingMsg
),
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
ImgDownloader
downloader
=
new
ImgDownloader
(
getActivity
(),
new
iImgDownloaderListener
()
{
@Override
public
void
loadComplete
()
{
progressDialog
.
dismiss
();
if
(
downloaded_students
.
size
()
>
1
)
{
for
(
int
i
=
0
;
i
<
imgs
.
size
();
i
++)
try
{
imageStudents
.
add
(
imgs
.
get
(
i
).
get_bitmap
(
getActivity
().
getBaseContext
()));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
StudentFragmentGrid
.
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
}
if
(
StudentFragmentGrid
.
super
.
getView
()!=
null
)
showStudentsGrid
();
else
onlineStudentsOK
=
true
;
}
@Override
public
void
loadImg
(
Img
image
)
{
}
public
void
error
(
Exception
e
)
{
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
PCBcontext
.
getContext
(),
R
.
string
.
serverError
,
e
.
getMessage
());
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
"Server error:"
+
e
.
getLocalizedMessage
());
}
},
ImgDownloader
.
tsource
.
remote
);
downloader
.
executeOnExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
,
imgs
);
}
private
void
download_students
(
int
sup_id
)
{
String
token
=
getActivity
().
getIntent
().
getExtras
().
getString
(
"token"
);
RestapiWrapper
wrapper
=
new
RestapiWrapper
(
getActivity
().
getApplicationContext
().
getResources
().
getString
(
R
.
string
.
server
),
token
);
String
operation
=
"sup/"
+
sup_id
+
"/students"
;
final
ProgressDialog
progressDialog
=
ProgressDialog
.
show
(
getActivity
(),
getString
(
R
.
string
.
userLoadingTxt
),
getString
(
R
.
string
.
userLoadingTxt
),
false
,
false
);
wrapper
.
ask
(
operation
,
new
iRestapiListener
()
{
@Override
public
void
error
(
Exception
e
)
{
Log
.
e
(
this
.
getClass
().
getName
(),
" Server restapi error: "
+
e
.
getLocalizedMessage
());
progressDialog
.
dismiss
();
GUITools
.
show_alert
(
getActivity
(),
R
.
string
.
loginErrorTxt
,
getString
(
R
.
string
.
serverError
),
new
GUITools
.
iOKListener
()
{
@Override
public
void
ok
()
{
PCBcontext
.
restart_app
();
}
});
}
@Override
public
void
preExecute
()
{
}
@Override
public
void
result
(
JSONArray
students
)
{
progressDialog
.
dismiss
();
StudentFragmentGrid
.
this
.
downloaded_students
=
new
Vector
();
for
(
int
i
=
0
;
i
<
students
.
length
();
i
++)
{
JSONObject
student
;
try
{
student
=
students
.
getJSONObject
(
i
);
if
(
student
.
getInt
(
TAG_SUPERVISION
)>
0
)
StudentFragmentGrid
.
this
.
downloaded_students
.
add
(
student
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
switch
(
students
.
length
())
{
case
0
:
GUITools
.
show_alert
(
getActivity
(),
R
.
string
.
loginErrorTxt
,
getString
(
R
.
string
.
noStudentsError
),
new
GUITools
.
iOKListener
()
{
@Override
public
void
ok
()
{
PCBcontext
.
restart_app
();
}
});
break
;
case
1
:
new_user
(
0
);
break
;
default
:
show_student_list_online
();
}
}
@Override
public
void
result
(
JSONObject
result
)
{
}
});
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setRetainInstance
(
true
);
Intent
intent
=
getActivity
().
getIntent
();
Boolean
offline
=
intent
.
getBooleanExtra
(
"offline"
,
false
);
int
sup_id
=
intent
.
getIntExtra
(
"sup_id"
,
0
);
if
(
offline
)
{
Vector
<
User
>
users
;
try
{
users
=
PCBcontext
.
getDevice
().
recoverStudents
(
sup_id
);
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Recovering "
+
users
.
size
()+
" students list for "
+
sup_id
+
" from local DB"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
users
=
null
;
}
int
i
=
0
;
this
.
nameStudents
=
new
String
[
users
.
size
()];
this
.
idStudents
=
new
Vector
<>(
users
.
size
());
this
.
imageStudents
=
new
Vector
<>(
users
.
size
());
for
(
User
user:
users
)
{
this
.
idStudents
.
add
(
user
.
get_id_stu
());
this
.
nameStudents
[
i
++]=
user
.
get_name_stu
();
try
{
this
.
imageStudents
.
add
(
user
.
get_bitmap_stu
(
getActivity
().
getBaseContext
()));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
this
.
getClass
().
getName
(),
" Getting images error: "
+
e
.
getLocalizedMessage
());
}
}
}
else
download_students
(
sup_id
);
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_new_student
,
container
,
false
);
gridView
=
(
GridView
)
view
.
findViewById
(
R
.
id
.
loginStudentGridView
);
Boolean
offline
=
getActivity
().
getIntent
().
getBooleanExtra
(
"offline"
,
false
);
if
(
offline
||
onlineStudentsOK
)
showStudentsGrid
();
return
view
;
}
}
android/Pictogram/app/src/main/java/com/yottacode/pictogram/gui/TapeAdapter.java
deleted
100644 → 0
View file @
1ad9f904
package
com
.
yottacode
.
pictogram
.
gui
;
import
android.annotation.TargetApi
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.speech.tts.TextToSpeech
;
import
android.speech.tts.UtteranceProgressListener
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.BaseAdapter
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
com.yottacode.pictogram.R
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
java.util.Iterator
;
import
java.util.LinkedList
;
public
class
TapeAdapter
extends
BaseAdapter
{
//private Context mContext;
private
LinkedList
<
Picto
>
pictoLinkedList
;
public
TapeAdapter
(){
//mContext = c;
pictoLinkedList
=
new
LinkedList
<
Picto
>();
// the list begins empty
}
@Override
public
int
getCount
(){
return
pictoLinkedList
.
size
();
}
public
Picto
getItem
(
int
position
)
{
// este método debería devolver el objeto que esta en esa posición del
// adapter.
return
pictoLinkedList
.
get
(
position
);
}
public
long
getItemId
(
int
position
)
{
// este método debería devolver el id de fila del item que esta en esa
// posición del adapter. No es necesario en este caso más que devolver 0.
return
0
;
}
// AÑADIR ITEM AL ADAPTADOR
public
void
addItem
(
Picto
p
){
pictoLinkedList
.
add
(
p
);
}
// ELIMINAR ITEM DEL ADAPTADOR
public
void
deleteItem
(
int
position
){
pictoLinkedList
.
remove
(
position
);
}
// ELIMINAR el último ITEM DEL ADAPTADOR
public
void
deleteLastView
(){
// Controlar excepcion al intentar eliminar el último cuando no hay elementos
try
{
pictoLinkedList
.
removeLast
();
}
catch
(
ArrayIndexOutOfBoundsException
exception
){
Log
.
e
(
"Excepción"
,
"ArrayIndexOutOfBounds: "
+
exception
.
getMessage
());
}
}
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
public
void
deleteAll
(){
pictoLinkedList
.
clear
();
}
// DEVUELVE TODOS LOS ELEMENTOS
public
LinkedList
<
Picto
>
getAll
(){
return
pictoLinkedList
;
}
// Devuelvo la cadena actual como un String
public
String
getAllAsString
(){
String
complete
=
""
;
Iterator
<
Picto
>
iterator
=
pictoLinkedList
.
iterator
();
while
(
iterator
.
hasNext
())
{
Picto
current
=
iterator
.
next
();
complete
+=
" "
+
current
.
get_translation
();
}
return
complete
;
}
// DEVUELVE último elemento
public
Picto
getLastItem
(){
return
pictoLinkedList
.
getLast
();
}
// Devuelve true o false si tiene o no elementos la lista de pictos
public
boolean
hasElements
(){
return
(
pictoLinkedList
.
size
()
>
0
);
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
){
return
PictoItemViewGenerator
.
getPictoView
(
this
.
pictoLinkedList
.
get
(
position
),
convertView
,
parent
);
}
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
public
void
ttsAllNew
(
TextToSpeech
tts
)
{
String
input
=
getAllAsString
();
Bundle
params
=
new
Bundle
();
params
.
putString
(
TextToSpeech
.
Engine
.
KEY_PARAM_VOLUME
,
"1"
);
params
.
putString
(
TextToSpeech
.
Engine
.
KEY_PARAM_UTTERANCE_ID
,
"TAPE_READ"
);
tts
.
speak
(
input
,
TextToSpeech
.
QUEUE_FLUSH
,
params
,
"TAPE_READ"
);
}
}
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/action/UnsubscribeAction.java
0 → 100644
View file @
56f0de79
package
com
.
yottacode
.
pictogram
.
action
;
/**
* User actions regarding a pictogram that happens when the user is online --> they are sent to the server by websockets (Room class)
* It is required, inter alia, to support session state diagram such
* as is depicted at http://scm.ujaen.es/files/note/1042/Estados_y_acciones.pdf
* and http://scm.ujaen.es/softuno/pictogram/wikis/LUActions
* @author Fernando Martinez Santiago
* @version 1.0
* @see Room
*/
public
class
UnsubscribeAction
extends
Action
{
//Picto Action types
public
static
final
String
UNSUBSCRIBE
=
"unsubscribe"
;
public
static
final
String
ACTION
=
"/stu/unsubscribe"
;
public
UnsubscribeAction
(
){
super
(
UNSUBSCRIBE
);
}
public
String
get_action
()
{
return
ACTION
;}
}
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