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
86cfb41f
authored
Jan 17, 2017
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' of
http://scm.ujaen.es/softuno/pictogram
into develop
parents
793d3111
e7cf465f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
165 additions
and
64 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.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/RadialMenuWidget.java
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/edit.png
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/eye_blocked.png
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/unlock.png
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
View file @
86cfb41f
...
@@ -373,6 +373,30 @@ Picto extends Img {
...
@@ -373,6 +373,30 @@ Picto extends Img {
}
}
/**
/**
* modify locally the status of the picto
* @param status the status that u press on the menu
* @return true if current status is enabled. False in other case.
*/
public
boolean
alter_status2
(
String
status
)
{
status
=
is_enabled
()
?
JSON_ATTTR_STATUS_VALUES
.
DISABLED
:
is_disabled
()
?
JSON_ATTTR_STATUS_VALUES
.
INVISIBLE
:
JSON_ATTTR_STATUS_VALUES
.
ENABLED
;
Log
.
i
(
this
.
getClass
().
getCanonicalName
(),
"Picto id. "
+
get_id
()+
" status enabled/disabled modified to "
+
is_enabled
());
try
{
this
.
attributes
.
put
(
JSON_ATTTRS
.
STATUS
,
status
);
set_local_status
(
true
);
if
(!
is_local
())
{
new
PictoUploader
(
this
).
uploadState
();
PCBcontext
.
getActionLog
().
log
(
new
VocabularyAction
(
VocabularyAction
.
ALTERATTRS
,
this
));
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
Log
.
e
(
this
.
getClass
().
getCanonicalName
(),
e
.
getMessage
());
}
return
is_enabled
();
}
/**
*
*
* @return true if the status of picto was modified from the PCB
* @return true if the status of picto was modified from the PCB
*/
*/
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/PictogramActivity.java
View file @
86cfb41f
...
@@ -14,6 +14,8 @@ import android.database.Cursor;
...
@@ -14,6 +14,8 @@ import android.database.Cursor;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.PixelFormat
;
import
android.graphics.PixelFormat
;
import
android.graphics.PorterDuff
;
import
android.graphics.PorterDuff
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.DrawableContainer
;
import
android.media.Ringtone
;
import
android.media.Ringtone
;
import
android.media.RingtoneManager
;
import
android.media.RingtoneManager
;
import
android.net.Uri
;
import
android.net.Uri
;
...
@@ -43,7 +45,6 @@ import android.widget.FrameLayout;
...
@@ -43,7 +45,6 @@ import android.widget.FrameLayout;
import
android.widget.GridView
;
import
android.widget.GridView
;
import
android.widget.ImageButton
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -68,6 +69,7 @@ import org.json.JSONException;
...
@@ -68,6 +69,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.ByteOrder
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
...
@@ -76,6 +78,9 @@ import java.util.Locale;
...
@@ -76,6 +78,9 @@ import java.util.Locale;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
import
java.util.concurrent.ScheduledThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
static
android
.
graphics
.
Color
.
BLACK
;
import
static
android
.
graphics
.
Color
.
argb
;
public
class
PictogramActivity
extends
Activity
implements
VocabularyTalk
.
iVocabularyListener
{
public
class
PictogramActivity
extends
Activity
implements
VocabularyTalk
.
iVocabularyListener
{
float
firstTouchX
=
-
1
;
float
firstTouchX
=
-
1
;
...
@@ -125,7 +130,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
...
@@ -125,7 +130,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
//Variables used on the picto menu (only supervisors)
//Variables used on the picto menu (only supervisors)
private
RadialMenuWidget
PieMenu
;
private
RadialMenuWidget
PieMenu
;
private
LinearLayout
ll
;
private
ImageView
detail
;
private
RelativeLayout
ll
;
@Override
@Override
...
@@ -866,9 +872,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
...
@@ -866,9 +872,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
//Si es supervisor hacer aparecer el menú de opciones del picto
//Si es supervisor hacer aparecer el menú de opciones del picto
View
pictoSquare
=
getCurrentPictoGridAdapter
().
getView
(
position
,
view
,
parent
);
View
pictoSquare
=
getCurrentPictoGridAdapter
().
getView
(
position
,
view
,
parent
);
if
(
pictoSquare
.
getWidth
()
==
100
){
//Si esta en formato de pictos normal
if
(
pictoSquare
.
getWidth
()
==
100
){
//Si esta en formato de pictos normal
createMenuForPicto
(
0
,
(
int
)
pictoSquare
.
getX
(),(
int
)
pictoSquare
.
getY
(),
p
.
get_column
(),
p
.
get_row
()
);
createMenuForPicto
(
0
,
p
);
}
else
{
}
else
{
createMenuForPicto
(
1
,
(
int
)
pictoSquare
.
getX
(),(
int
)
pictoSquare
.
getY
(),
p
.
get_column
(),
p
.
get_row
()
);
createMenuForPicto
(
1
,
p
);
}
}
//p.alter_status();
//p.alter_status();
getCurrentPictoGridAdapter
().
notifyDataSetChanged
();
getCurrentPictoGridAdapter
().
notifyDataSetChanged
();
...
@@ -1251,29 +1257,65 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
...
@@ -1251,29 +1257,65 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
int
red
=
Color
.
red
(
color
);
int
red
=
Color
.
red
(
color
);
int
green
=
Color
.
green
(
color
);
int
green
=
Color
.
green
(
color
);
int
blue
=
Color
.
blue
(
color
);
int
blue
=
Color
.
blue
(
color
);
return
Color
.
argb
(
alpha
,
red
,
green
,
blue
);
return
argb
(
alpha
,
red
,
green
,
blue
);
}
}
private
void
createMenuForPicto
(
int
tamPicto
,
int
posX
,
int
posY
,
int
nCol
,
int
nFila
){
private
void
createMenuForPicto
(
int
tamPicto
,
Picto
picto
){
ll
=
new
LinearLayout
(
this
);
ll
=
new
RelativeLayout
(
PCBcontext
.
getContext
()
);
LinearLayout
.
LayoutParams
params
=
new
LinearLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
params
=
new
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
LinearLayout
.
LayoutParams
.
MATCH_PARENT
,
Linear
Layout
.
LayoutParams
.
MATCH_PARENT
);
Relative
Layout
.
LayoutParams
.
MATCH_PARENT
);
addContentView
(
ll
,
params
);
addContentView
(
ll
,
params
);
ll
.
setBackgroundColor
(
argb
(
180
,
0
,
0
,
0
));
detail
=
new
ImageView
(
PCBcontext
.
getContext
());
int
centerX
=
PictogramActivity
.
this
.
getResources
().
getDisplayMetrics
().
widthPixels
/
2
;
int
centerY
=
PictogramActivity
.
this
.
getResources
().
getDisplayMetrics
().
heightPixels
/
2
;
if
(
tamPicto
==
0
){
centerY
+=
100
;
detail
.
setMaxWidth
(
90
);
}
else
{
centerY
+=
135
;
detail
.
setMaxWidth
(
115
);
}
PieMenu
=
new
RadialMenuWidget
(
PCBcontext
.
getContext
());
PieMenu
=
new
RadialMenuWidget
(
PCBcontext
.
getContext
());
PieMenu
.
setAnimationSpeed
(
0L
);
PieMenu
.
setAnimationSpeed
(
0L
);
//int xLayoutSize = ll.getWidth();
//int yLayoutSize = ll.getHeight();
//PieMenu.setSourceLocation(posX,posY);
/**Para obtener posicion x => posX + tamPicto/2 + nºcolumna(considerar espacios entre pictos)
PieMenu
.
setCenterLocation
(
centerX
-
(
PieMenu
.
getcRadius
()*
2
)
-
50
,
centerY
-(
PieMenu
.
getcRadius
()*
2
));
PieMenu
.
setIconSize
(
20
,
35
);
//Tamaño del icono
PieMenu
.
setCenterCircle
(
new
Close
());
PieMenu
.
addMenuEntry
(
new
UnlockPictoMenu
());
PieMenu
.
addMenuEntry
(
new
DisablePictoMenu
());
PieMenu
.
addMenuEntry
(
new
SetInvisibleMenu
());
PieMenu
.
addMenuEntry
(
new
EditMenu
());
PieMenu
.
setPicto
(
picto
);
ll
.
addView
(
PieMenu
);
try
{
detail
.
setImageBitmap
(
picto
.
get_bitmap
(
PCBcontext
.
getContext
()));
detail
.
setBackgroundColor
(
picto
.
get_color
());
detail
.
setX
(
centerX
+
10
);
detail
.
setY
(
centerY
-
(
picto
.
get_bitmap
(
PCBcontext
.
getContext
()).
getHeight
()));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
ll
.
addView
(
detail
);
/**Para el menú encima del picto
* Para obtener posicion x => posX + tamPicto/2 + nºcolumna(considerar espacios entre pictos)
Para obtener posicion y => posX + tamPicto/2 + nºfila(considerar espacios entre pictos) + tamBarraDialogo(100 o 145)*/
Para obtener posicion y => posX + tamPicto/2 + nºfila(considerar espacios entre pictos) + tamBarraDialogo(100 o 145)*/
//Segun tamaño de los pictos pongo el menu de un tamaño o de otro y calculo distancias
//Segun tamaño de los pictos pongo el menu de un tamaño o de otro y calculo distancias
//TODO: Cambiar tamaño del menu segun tamaño del pictograma
/*if(tamPicto==0){
if
(
tamPicto
==
0
){
posX = posX + nCol + 100/2;
posX = posX + nCol + 100/2;
posY = posY + nFila + 94/2 + 100;
posY = posY + nFila + 94/2 + 100;
PieMenu.setCenterLocation(posX,posY); //Posicion del widget en la pantalla(Encima del picto seleccionado)
PieMenu.setCenterLocation(posX,posY); //Posicion del widget en la pantalla(Encima del picto seleccionado)
...
@@ -1283,21 +1325,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
...
@@ -1283,21 +1325,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
posY = posY + nFila + 115/2 + 145;
posY = posY + nFila + 115/2 + 145;
PieMenu.setCenterLocation(posX,posY); //Posicion del widget en la pantalla(Encima del picto seleccionado)
PieMenu.setCenterLocation(posX,posY); //Posicion del widget en la pantalla(Encima del picto seleccionado)
PieMenu.setIconSize(10,25);
PieMenu.setIconSize(10,25);
}
}*/
PieMenu
.
setIconSize
(
20
,
35
);
//Tamaño del icono
//PieMenu.setTextSize(13); //Tamaño del texto
//PieMenu.setSourceLocation(xLayoutSize,yLayoutSize);
PieMenu
.
setIconSize
(
10
,
25
);
PieMenu
.
setTextSize
(
13
);
PieMenu
.
setCenterCircle
(
new
Close
());
PieMenu
.
addMenuEntry
(
new
DisablePictoMenu
());
PieMenu
.
addMenuEntry
(
new
EditLegendMenu
());
PieMenu
.
addMenuEntry
(
new
ChangePictoMenu
());
PieMenu
.
addMenuEntry
(
new
UnlockPictoMenu
());
ll
.
addView
(
PieMenu
);
}
}
//TODO: Añadir iconos y cambiarlos en cada boton
//TODO: Añadir iconos y cambiarlos en cada boton
...
@@ -1312,55 +1340,64 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
...
@@ -1312,55 +1340,64 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
//Metodo para realizar acciones si se pulsa
//Metodo para realizar acciones si se pulsa
public
void
menuActiviated
()
public
void
menuActiviated
()
{
{
((
LinearLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
ll
.
setVisibility
(
View
.
GONE
);
((
RelativeLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
}
}
}
}
//Disable menu button
//Disable menu button
public
static
class
DisablePictoMenu
implements
RadialMenuWidget
.
RadialMenuEntry
public
class
DisablePictoMenu
implements
RadialMenuWidget
.
RadialMenuEntry
{
{
public
String
getName
()
{
return
"
IconOnly
"
;
}
public
String
getName
()
{
return
"
disable
"
;
}
public
String
getLabel
()
{
return
null
;
}
public
String
getLabel
()
{
return
null
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
disabled_picto
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
disabled_picto
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
void
menuActiviated
()
public
void
menuActiviated
()
{
{
ll
.
setVisibility
(
View
.
GONE
);
((
RelativeLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
}
}
}
}
//Edit legend of picto menu button
//Edit legend of picto menu button
public
static
class
EditLegend
Menu
implements
RadialMenuWidget
.
RadialMenuEntry
public
class
Edit
Menu
implements
RadialMenuWidget
.
RadialMenuEntry
{
{
public
String
getName
()
{
return
"
IconOnly
"
;
}
public
String
getName
()
{
return
"
edit
"
;
}
public
String
getLabel
()
{
return
null
;
}
public
String
getLabel
()
{
return
null
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
disabled_picto
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
edit
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
void
menuActiviated
()
public
void
menuActiviated
()
{
{
ll
.
setVisibility
(
View
.
GONE
);
((
RelativeLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
}
}
}
}
//Change image of picto menu button
//Change image of picto menu button
public
static
class
ChangePicto
Menu
implements
RadialMenuWidget
.
RadialMenuEntry
public
class
SetInvisible
Menu
implements
RadialMenuWidget
.
RadialMenuEntry
{
{
public
String
getName
()
{
return
"
IconOnly
"
;
}
public
String
getName
()
{
return
"
invisible
"
;
}
public
String
getLabel
()
{
return
null
;
}
public
String
getLabel
()
{
return
null
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
disabled_picto
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
eye_blocked
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
void
menuActiviated
()
public
void
menuActiviated
()
{
{
ll
.
setVisibility
(
View
.
GONE
);
((
RelativeLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
}
}
}
}
//Activate/enable picto on vocabulary menu button
//Activate/enable picto on vocabulary menu button
public
static
class
UnlockPictoMenu
implements
RadialMenuWidget
.
RadialMenuEntry
public
class
UnlockPictoMenu
implements
RadialMenuWidget
.
RadialMenuEntry
{
{
public
String
getName
()
{
return
"
IconOnly
"
;
}
public
String
getName
()
{
return
"
enable
"
;
}
public
String
getLabel
()
{
return
null
;
}
public
String
getLabel
()
{
return
null
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
disabled_picto
;
}
public
int
getIcon
()
{
return
R
.
drawable
.
unlock
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
List
<
RadialMenuWidget
.
RadialMenuEntry
>
getChildren
()
{
return
null
;
}
public
void
menuActiviated
()
public
void
menuActiviated
()
{
{
ll
.
setVisibility
(
View
.
GONE
);
((
RelativeLayout
)
PieMenu
.
getParent
()).
removeView
(
PieMenu
);
}
}
}
}
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/RadialMenuWidget.java
View file @
86cfb41f
...
@@ -20,9 +20,13 @@ import android.view.animation.DecelerateInterpolator;
...
@@ -20,9 +20,13 @@ import android.view.animation.DecelerateInterpolator;
import
android.view.animation.RotateAnimation
;
import
android.view.animation.RotateAnimation
;
import
android.view.animation.ScaleAnimation
;
import
android.view.animation.ScaleAnimation
;
import
android.view.animation.TranslateAnimation
;
import
android.view.animation.TranslateAnimation
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.yottacode.pictogram.dao.Picto
;
import
com.yottacode.pictogram.tools.PCBcontext
;
public
class
RadialMenuWidget
extends
View
{
public
class
RadialMenuWidget
extends
View
{
//Defines the interface
//Defines the interface
...
@@ -34,6 +38,7 @@ public class RadialMenuWidget extends View {
...
@@ -34,6 +38,7 @@ public class RadialMenuWidget extends View {
void
menuActiviated
();
void
menuActiviated
();
}
}
private
Picto
picto
;
private
List
<
RadialMenuEntry
>
menuEntries
=
new
ArrayList
<
RadialMenuEntry
>();
private
List
<
RadialMenuEntry
>
menuEntries
=
new
ArrayList
<
RadialMenuEntry
>();
private
RadialMenuEntry
centerCircle
=
null
;
private
RadialMenuEntry
centerCircle
=
null
;
...
@@ -86,8 +91,8 @@ public class RadialMenuWidget extends View {
...
@@ -86,8 +91,8 @@ public class RadialMenuWidget extends View {
private
int
textSize
=
scalePX
(
15
);
//TextSize
private
int
textSize
=
scalePX
(
15
);
//TextSize
private
int
animateTextSize
=
textSize
;
private
int
animateTextSize
=
textSize
;
private
int
xPosition
=
scalePX
(
120
)
;
//Center X location of Radial Menu
private
int
xPosition
;
//Center X location of Radial Menu
private
int
yPosition
=
scalePX
(
120
)
;
//Center Y location of Radial Menu
private
int
yPosition
;
//Center Y location of Radial Menu
private
int
xSource
=
0
;
//Source X of clicked location
private
int
xSource
=
0
;
//Source X of clicked location
private
int
ySource
=
0
;
//Center Y of clicked location
private
int
ySource
=
0
;
//Center Y of clicked location
...
@@ -125,13 +130,12 @@ public class RadialMenuWidget extends View {
...
@@ -125,13 +130,12 @@ public class RadialMenuWidget extends View {
private
boolean
animateOuterOut
=
false
;
private
boolean
animateOuterOut
=
false
;
public
RadialMenuWidget
(
Context
context
)
{
public
RadialMenuWidget
(
Context
context
)
{
super
(
context
);
super
(
context
);
// Gets screen specs and defaults to center of screen
// Gets screen specs and defaults to center of screen
this
.
xPosition
=
(
getResources
().
getDisplayMetrics
().
widthPixels
)/
2
;
//
this.xPosition = (getResources().getDisplayMetrics().widthPixels)/2;
this
.
yPosition
=
(
getResources
().
getDisplayMetrics
().
heightPixels
)/
2
;
//
this.yPosition = (getResources().getDisplayMetrics().heightPixels)/2;
determineWedges
();
determineWedges
();
onOpenAnimation
();
onOpenAnimation
();
...
@@ -146,6 +150,7 @@ public class RadialMenuWidget extends View {
...
@@ -146,6 +150,7 @@ public class RadialMenuWidget extends View {
if
(
state
==
MotionEvent
.
ACTION_DOWN
)
{
if
(
state
==
MotionEvent
.
ACTION_DOWN
)
{
//selected = null;
//selected = null;
//selected2 = null;
//selected2 = null;
inWedge
=
false
;
inWedge
=
false
;
inWedge2
=
false
;
inWedge2
=
false
;
inCircle
=
false
;
inCircle
=
false
;
...
@@ -201,6 +206,8 @@ public class RadialMenuWidget extends View {
...
@@ -201,6 +206,8 @@ public class RadialMenuWidget extends View {
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
}
}
selected
=
null
;
selected
=
null
;
//Close button message
Toast
.
makeText
(
getContext
(),
centerCircle
.
getName
()
+
" pressed."
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getContext
(),
centerCircle
.
getName
()
+
" pressed."
,
Toast
.
LENGTH_SHORT
).
show
();
centerCircle
.
menuActiviated
();
centerCircle
.
menuActiviated
();
...
@@ -211,14 +218,41 @@ public class RadialMenuWidget extends View {
...
@@ -211,14 +218,41 @@ public class RadialMenuWidget extends View {
//Checks if a inner ring is enabled if so closes the outer ring an
//Checks if a inner ring is enabled if so closes the outer ring an
if
(
enabled
!=
null
)
{
if
(
enabled
!=
null
)
{
Toast
.
makeText
(
getContext
(),
"Closing outer ring"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(getContext(), "Closing outer ring", Toast.LENGTH_SHORT).show();
enabled
=
null
;
enabled
=
null
;
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
//If outer ring is not enabled, then executes event
//If outer ring is not enabled, then executes event
}
else
{
}
else
{
Toast
.
makeText
(
getContext
(),
menuEntries
.
get
(
i
).
getName
()
+
" pressed."
,
Toast
.
LENGTH_SHORT
).
show
();
menuEntries
.
get
(
i
).
menuActiviated
();
/**TODO: Gestionar aqui los mensajes de los botones y realizar la accion que corresponda al picto(switch)
* Ahora mismo fundiona en local*/
switch
(
menuEntries
.
get
(
i
).
getName
()){
case
"disable"
:
if
(
picto
.
get_status
()
==
"invisible"
){
Toast
.
makeText
(
getContext
(),
"El picto esta inactivo"
,
Toast
.
LENGTH_SHORT
).
show
();
}
picto
.
alter_status2
(
"disabled"
);
Toast
.
makeText
(
getContext
(),
"Picto Deshabilitado"
,
Toast
.
LENGTH_SHORT
).
show
();
menuEntries
.
get
(
i
).
menuActiviated
();
break
;
case
"enable"
:
picto
.
alter_status2
(
"enabled"
);
Toast
.
makeText
(
getContext
(),
"Picto Habilitado"
,
Toast
.
LENGTH_SHORT
).
show
();
menuEntries
.
get
(
i
).
menuActiviated
();
break
;
case
"invisible"
:
picto
.
alter_status2
(
"invisible"
);
Toast
.
makeText
(
getContext
(),
"Picto Invisible"
,
Toast
.
LENGTH_SHORT
).
show
();
menuEntries
.
get
(
i
).
menuActiviated
();
break
;
case
"edit"
:
Toast
.
makeText
(
getContext
(),
"Editar Picto"
,
Toast
.
LENGTH_SHORT
).
show
();
menuEntries
.
get
(
i
).
menuActiviated
();
break
;
}
//Figures out how many outer rings
//Figures out how many outer rings
if
(
menuEntries
.
get
(
i
).
getChildren
()
!=
null
)
{
if
(
menuEntries
.
get
(
i
).
getChildren
()
!=
null
)
{
...
@@ -238,7 +272,7 @@ public class RadialMenuWidget extends View {
...
@@ -238,7 +272,7 @@ public class RadialMenuWidget extends View {
for
(
int
i
=
0
;
i
<
Wedges2
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
Wedges2
.
length
;
i
++)
{
Wedge
f
=
Wedges2
[
i
];
Wedge
f
=
Wedges2
[
i
];
if
(
f
==
selected2
)
{
if
(
f
==
selected2
)
{
Toast
.
makeText
(
getContext
(),
wedge2Data
.
getChildren
().
get
(
i
).
getName
()
+
" pressed."
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(getContext(), wedge2Data.getChildren().get(i).getName() + " pressed.", Toast.LENGTH_SHORT).show();
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
animateOuterIn
=
true
;
//sets Wedge2Shown = false;
enabled
=
null
;
enabled
=
null
;
selected
=
null
;
selected
=
null
;
...
@@ -246,7 +280,7 @@ public class RadialMenuWidget extends View {
...
@@ -246,7 +280,7 @@ public class RadialMenuWidget extends View {
}
}
}
else
{
}
else
{
//This is when something outside the circle or any of the rings is selected
//This is when something outside the circle or any of the rings is selected
Toast
.
makeText
(
getContext
(),
"
Area outside rings pressed.
"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getContext
(),
"
Pulse dentro del menú
"
,
Toast
.
LENGTH_SHORT
).
show
();
//selected = null;
//selected = null;
//enabled = null;
//enabled = null;
...
@@ -657,6 +691,7 @@ public class RadialMenuWidget extends View {
...
@@ -657,6 +691,7 @@ public class RadialMenuWidget extends View {
paint
.
setStyle
(
Paint
.
Style
.
FILL
);
paint
.
setStyle
(
Paint
.
Style
.
FILL
);
paint
.
setTextSize
(
headerTextSize
);
paint
.
setTextSize
(
headerTextSize
);
c
.
drawText
(
headerString
,
headerTextLeft
,
headerTextBottom
,
paint
);
c
.
drawText
(
headerString
,
headerTextLeft
,
headerTextBottom
,
paint
);
}
}
}
}
...
@@ -664,18 +699,17 @@ public class RadialMenuWidget extends View {
...
@@ -664,18 +699,17 @@ public class RadialMenuWidget extends View {
private
int
getIconSize
(
int
iconSize
,
int
minSize
,
int
maxSize
)
{
private
int
getIconSize
(
int
iconSize
,
int
minSize
,
int
maxSize
)
{
if
(
iconSize
>
minSize
)
{
if
(
iconSize
>
minSize
)
{
if
(
iconSize
>
maxSize
)
{
if
(
iconSize
>
maxSize
)
{
return
maxSize
;
return
maxSize
;
}
else
{
//iconSize < maxSize
}
else
{
//iconSize < maxSize
return
iconSize
;
return
iconSize
;
}
}
}
else
{
//iconSize < minSize
}
else
{
//iconSize < minSize
return
minSize
;
return
minSize
;
}
}
}
}
private
void
onOpenAnimation
()
{
private
void
onOpenAnimation
()
{
...
@@ -756,7 +790,6 @@ public class RadialMenuWidget extends View {
...
@@ -756,7 +790,6 @@ public class RadialMenuWidget extends View {
return
false
;
return
false
;
}
}
public
boolean
addMenuEntry
(
RadialMenuEntry
entry
)
public
boolean
addMenuEntry
(
RadialMenuEntry
entry
)
{
{
menuEntries
.
add
(
entry
);
menuEntries
.
add
(
entry
);
...
@@ -813,6 +846,10 @@ public class RadialMenuWidget extends View {
...
@@ -813,6 +846,10 @@ public class RadialMenuWidget extends View {
onOpenAnimation
();
onOpenAnimation
();
}
}
public
void
setPicto
(
Picto
p
){
picto
=
p
;
}
public
void
setSourceLocation
(
int
x
,
int
y
)
public
void
setSourceLocation
(
int
x
,
int
y
)
{
{
this
.
xSource
=
x
;
this
.
xSource
=
x
;
...
@@ -887,6 +924,9 @@ public class RadialMenuWidget extends View {
...
@@ -887,6 +924,9 @@ public class RadialMenuWidget extends View {
return
px_size
;
return
px_size
;
}
}
public
int
getcRadius
(){
return
cRadius
;
}
private
void
animateOuterWedges
(
int
animation_direction
)
{
private
void
animateOuterWedges
(
int
animation_direction
)
{
...
...
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/edit.png
0 → 100644
View file @
86cfb41f
2.24 KB
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/eye_blocked.png
0 → 100644
View file @
86cfb41f
1.49 KB
android/Pictogram/tabletlibrary/src/main/res/drawable-hdpi/unlock.png
0 → 100644
View file @
86cfb41f
1.19 KB
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