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
6a9cfc82
authored
Jan 19, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue #816 closed
parent
42b3ba10
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
23 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/websockets/VocabularyTalk.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/PictoItemViewGenerator.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/PictogramActivity.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/TapeAdapter.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/websockets/VocabularyTalk.java
View file @
6a9cfc82
...
...
@@ -38,6 +38,7 @@ public class VocabularyTalk implements Emitter.Listener {
final
String
action_add
=
"add"
;
final
String
action_delete
=
"delete"
;
JSONObject
msg
=
(
JSONObject
)
args
[
0
];
try
{
Log
.
i
(
LOG_TAG
,
"raw Received message "
+
msg
.
toString
());
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/PictoItemViewGenerator.java
View file @
6a9cfc82
package
com
.
yottacode
.
pictogram
.
tabletlibrary
.
gui
;
import
android.animation.ObjectAnimator
;
import
android.animation.ValueAnimator
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.PorterDuff
;
import
android.support.v4.content.ContextCompat
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.LayoutInflater
;
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/PictogramActivity.java
View file @
6a9cfc82
...
...
@@ -31,7 +31,6 @@ import android.view.KeyEvent;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewParent
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.animation.AccelerateDecelerateInterpolator
;
...
...
@@ -918,6 +917,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
if
(
lp
.
size
()>
0
&&
!
PictogramActivity
.
this
.
tapeAdapter
.
play
())
{
PCBcontext
.
getActionLog
().
log
(
new
PictosAction
(
lp
));
tapeAdapter
.
ttsAllNew
(
tts
);
if
(!
PCBcontext
.
getPcbdb
().
getCurrentUser
().
delete_tape_after_delivery
())
animateTapeView
(
0
,(
ViewGroup
)
arg0
.
getParent
());
}
}
}
...
...
@@ -1253,6 +1253,58 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
}
public
void
animateTapeView
(
final
int
position
,
final
ViewGroup
view
)
{
GridView
gridview
=
(
GridView
)
view
.
getChildAt
(
1
);
RelativeLayout
relativeLayout
=(
RelativeLayout
)(
gridview
.
getChildAt
(
position
));
FrameLayout
layout
=(
FrameLayout
)(
relativeLayout
.
getChildAt
(
0
));
final
ImageView
v
=(
ImageView
)(
layout
.
getChildAt
(
0
));
final
int
orange
=
ContextCompat
.
getColor
(
PCBcontext
.
getContext
(),
R
.
color
.
red
);
final
ValueAnimator
colorAnim
=
ObjectAnimator
.
ofFloat
(
0
f
,
1
f
,
0
f
);
colorAnim
.
addUpdateListener
(
new
ValueAnimator
.
AnimatorUpdateListener
()
{
@Override
public
void
onAnimationUpdate
(
ValueAnimator
animation
)
{
float
mul
=
(
Float
)
animation
.
getAnimatedValue
();
int
alphaOrange
=
adjustAlpha
(
orange
,
mul
);
v
.
setColorFilter
(
alphaOrange
,
PorterDuff
.
Mode
.
SRC_ATOP
);
v
.
setBackgroundColor
(
alphaOrange
);
v
.
setPadding
(
0
,
0
,
0
,
0
);
if
(
mul
==
0.0
)
{
v
.
setColorFilter
(
0
);
}
}
});
colorAnim
.
addListener
(
new
ValueAnimator
.
AnimatorListener
()
{
@Override
public
void
onAnimationStart
(
Animator
animation
)
{
}
@Override
public
void
onAnimationEnd
(
Animator
animation
)
{
v
.
setColorFilter
(
0
);
v
.
setBackgroundColor
(
ContextCompat
.
getColor
(
PCBcontext
.
getContext
(),
R
.
color
.
picto_default_background
));
if
(
position
<(
tapeAdapter
.
getCount
()-
1
))
animateTapeView
(
position
+
1
,
view
);
}
@Override
public
void
onAnimationCancel
(
Animator
animation
)
{
}
@Override
public
void
onAnimationRepeat
(
Animator
animation
)
{
}
});
colorAnim
.
setDuration
(
tapeAdapter
.
getItem
(
position
).
get_translation
().
length
()*
100
);
colorAnim
.
start
();
}
public
static
int
adjustAlpha
(
int
color
,
float
factor
)
{
int
alpha
=
Math
.
round
(
Color
.
alpha
(
color
)
*
factor
);
int
red
=
Color
.
red
(
color
);
...
...
@@ -1385,7 +1437,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
PieMenu
.
addMenuEntry
(
new
UnlockPictoMenu
(
picto
));
PieMenu
.
addMenuEntry
(
new
DisablePictoMenu
(
picto
));
PieMenu
.
addMenuEntry
(
new
SetInvisibleMenu
(
picto
));
PieMenu
.
addMenuEntry
(
new
EditMenu
(
picto
));
//
PieMenu.addMenuEntry(new EditMenu(picto));
ll
.
addView
(
PieMenu
);
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/TapeAdapter.java
View file @
6a9cfc82
...
...
@@ -19,15 +19,15 @@ public class TapeAdapter extends BaseAdapter {
//private Context mContext;
private
LinkedList
<
Picto
>
pictoLinkedList
;
private
boolean
play
=
false
;
private
boolean
play
=
false
;
public
TapeAdapter
(){
public
TapeAdapter
()
{
//mContext = c;
pictoLinkedList
=
new
LinkedList
<
Picto
>();
// the list begins empty
}
@Override
public
int
getCount
(){
public
int
getCount
()
{
return
pictoLinkedList
.
size
();
}
...
...
@@ -44,37 +44,40 @@ public class TapeAdapter extends BaseAdapter {
}
// AÑADIR ITEM AL ADAPTADOR
public
void
addItem
(
Picto
p
){
public
void
addItem
(
Picto
p
)
{
pictoLinkedList
.
add
(
p
);
}
// ELIMINAR ITEM DEL ADAPTADOR
public
void
deleteItem
(
int
position
){
public
void
deleteItem
(
int
position
)
{
pictoLinkedList
.
remove
(
position
);
}
// ELIMINAR el último ITEM DEL ADAPTADOR
public
void
deleteLastView
(){
public
void
deleteLastView
()
{
// Controlar excepcion al intentar eliminar el último cuando no hay elementos
try
{
try
{
pictoLinkedList
.
removeLast
();
}
catch
(
ArrayIndexOutOfBoundsException
exception
)
{
}
catch
(
ArrayIndexOutOfBoundsException
exception
)
{
Log
.
e
(
"Excepción"
,
"ArrayIndexOutOfBounds: "
+
exception
.
getMessage
());
}
}
// ELIMINAR TODOS LOS ITEMS DEL ADAPTADOR
public
void
endPlay
(){
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
delete_tape_after_delivery
())
pictoLinkedList
.
clear
();
play
=
false
;
public
void
endPlay
()
{
if
(
PCBcontext
.
getPcbdb
().
getCurrentUser
().
delete_tape_after_delivery
())
pictoLinkedList
.
clear
();
play
=
false
;
}
// DEVUELVE TODOS LOS ELEMENTOS
public
LinkedList
<
Picto
>
getAll
(){
return
pictoLinkedList
;
}
public
LinkedList
<
Picto
>
getAll
()
{
return
pictoLinkedList
;
}
// Devuelvo la cadena actual como un String
public
String
getAllAsString
(){
public
String
getAllAsString
()
{
String
complete
=
""
;
Iterator
<
Picto
>
iterator
=
pictoLinkedList
.
iterator
();
while
(
iterator
.
hasNext
())
{
...
...
@@ -85,19 +88,18 @@ public class TapeAdapter extends BaseAdapter {
}
// DEVUELVE último elemento
public
Picto
getLastItem
(){
public
Picto
getLastItem
()
{
return
pictoLinkedList
.
getLast
();
}
// Devuelve true o false si tiene o no elementos la lista de pictos
public
boolean
hasElements
(){
public
boolean
hasElements
()
{
return
(
pictoLinkedList
.
size
()
>
0
);
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
){
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
View
pictoView
=
PictoItemViewGenerator
.
getPictoView
(
this
.
pictoLinkedList
.
get
(
position
),
convertView
,
...
...
@@ -107,7 +109,7 @@ public class TapeAdapter extends BaseAdapter {
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
public
void
ttsAllNew
(
TTSHelper
tts
)
{
this
.
play
=
true
;
this
.
play
=
true
;
String
input
=
getAllAsString
();
tts
.
play
(
input
);
}
...
...
@@ -115,4 +117,6 @@ public class TapeAdapter extends BaseAdapter {
public
boolean
play
()
{
return
this
.
play
;
}
}
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