Commit 42b3ba10 by German Callejas

Submenu para editar pictos añadido, funcionando el cambiar la etiqueta(leyenda)

parent 94e87157
...@@ -31,6 +31,7 @@ import android.view.KeyEvent; ...@@ -31,6 +31,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateDecelerateInterpolator;
...@@ -1277,7 +1278,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1277,7 +1278,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
//Parameters for hide navigation bar when u save or cancel //Parameters for hide navigation bar when u save or cancel
final View decorView = getWindow().getDecorView(); final View decorView = getWindow().getDecorView();
final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION final int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN; /*| View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE*/;
final EditText leyenda = new EditText(PCBcontext.getContext()); final EditText leyenda = new EditText(PCBcontext.getContext());
leyenda.setBackgroundColor(rgb(221, 221, 211)); leyenda.setBackgroundColor(rgb(221, 221, 211));
...@@ -1285,11 +1286,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1285,11 +1286,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
leyenda.setMaxLines(1); leyenda.setMaxLines(1);
leyenda.setClickable(true); leyenda.setClickable(true);
leyenda.setTextSize(25); leyenda.setTextSize(25);
leyenda.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 - 400); leyenda.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 - 300);
leyenda.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50); leyenda.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50);
leyenda.setTextColor(BLACK); leyenda.setTextColor(BLACK);
if(picto.get_translation()!=null){ if(picto.get_translation()!= null && picto != null){
leyenda.setText(picto.get_translation()); leyenda.setText(picto.get_translation());
}else{ }else{
leyenda.setText("Sin Descripción"); leyenda.setText("Sin Descripción");
} }
...@@ -1301,7 +1302,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1301,7 +1302,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ImageButton botonOk = new ImageButton(PCBcontext.getContext()); ImageButton botonOk = new ImageButton(PCBcontext.getContext());
botonOk.setImageResource(android.R.drawable.ic_menu_save); botonOk.setImageResource(android.R.drawable.ic_menu_save);
botonOk.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 + 10); botonOk.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 + 110);
botonOk.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50); botonOk.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50);
botonOk.setBackgroundColor(rgb(221,221,221)); botonOk.setBackgroundColor(rgb(221,221,221));
botonOk.setOnClickListener(new View.OnClickListener() { botonOk.setOnClickListener(new View.OnClickListener() {
...@@ -1316,14 +1317,16 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1316,14 +1317,16 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
} }
getCurrentPictoGridAdapter().notifyDataSetChanged(); getCurrentPictoGridAdapter().notifyDataSetChanged();
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
//Hide navigation bar //Hide navigation bar
//PictogramActivity.this.refresh();
decorView.setSystemUiVisibility(uiOptions); decorView.setSystemUiVisibility(uiOptions);
} }
}); });
ImageButton botonSalir = new ImageButton(PCBcontext.getContext()); ImageButton botonSalir = new ImageButton(PCBcontext.getContext());
botonSalir.setImageResource(android.R.drawable.ic_menu_close_clear_cancel); botonSalir.setImageResource(android.R.drawable.ic_menu_close_clear_cancel);
botonSalir.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 + 80); botonSalir.setX(PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2 + 150);
botonSalir.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50); botonSalir.setY(PictogramActivity.this.getResources().getDisplayMetrics().heightPixels/2 - 50);
botonSalir.setBackgroundColor(rgb(221,221,221)); botonSalir.setBackgroundColor(rgb(221,221,221));
botonSalir.setOnClickListener(new View.OnClickListener() { botonSalir.setOnClickListener(new View.OnClickListener() {
...@@ -1331,7 +1334,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1331,7 +1334,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public void onClick(View v) { public void onClick(View v) {
imm.hideSoftInputFromWindow(leyenda.getWindowToken(), 0); imm.hideSoftInputFromWindow(leyenda.getWindowToken(), 0);
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
//Hide navigation bar //Hide navigation bar
//PictogramActivity.this.refresh();
decorView.setSystemUiVisibility(uiOptions); decorView.setSystemUiVisibility(uiOptions);
} }
}); });
...@@ -1356,7 +1361,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1356,7 +1361,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ll.setBackgroundColor(argb(180,0,0,0)); ll.setBackgroundColor(argb(180,0,0,0));
detail = new ImageView(PCBcontext.getContext()); detail = new ImageView(PCBcontext.getContext());
int centerX = PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2; int centerX = PictogramActivity.this.getResources().getDisplayMetrics().widthPixels/2;
...@@ -1414,6 +1418,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1414,6 +1418,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
((RelativeLayout)PieMenu.getParent()).removeView(PieMenu); ((RelativeLayout)PieMenu.getParent()).removeView(PieMenu);
} }
public void menuDisabled(){}
} }
//Disable menu button //Disable menu button
...@@ -1434,6 +1439,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1434,6 +1439,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
((RelativeLayout)PieMenu.getParent()).removeView(PieMenu); ((RelativeLayout)PieMenu.getParent()).removeView(PieMenu);
} }
public void menuDisabled(){}
} }
//Change image of picto menu button //Change image of picto menu button
...@@ -1455,6 +1461,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1455,6 +1461,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
((RelativeLayout)PieMenu.getParent()).removeView(PieMenu); ((RelativeLayout)PieMenu.getParent()).removeView(PieMenu);
} }
public void menuDisabled(){}
} }
//Activate/enable picto on vocabulary menu button //Activate/enable picto on vocabulary menu button
...@@ -1476,6 +1483,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1476,6 +1483,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
((RelativeLayout)PieMenu.getParent()).removeView(PieMenu); ((RelativeLayout)PieMenu.getParent()).removeView(PieMenu);
} }
public void menuDisabled(){}
} }
//Edit menu button //Edit menu button
...@@ -1488,12 +1496,15 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1488,12 +1496,15 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public String getName() { return "edit"; } public String getName() { return "edit"; }
public String getLabel() { return null; } public String getLabel() { return null; }
public int getIcon() { return R.drawable.edit; } public int getIcon() { return R.drawable.edit; }
private List<RadialMenuWidget.RadialMenuEntry> children = new ArrayList<>(Arrays.asList( new EditTextPicto(this.p), new EditImage(this.p))); private List<RadialMenuWidget.RadialMenuEntry> children;
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return children; } public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return children; }
public void menuActiviated() public void menuActiviated()
{ {
/**TODO: Llamar a la interfaz de editar foto y leyenda*/ ll.getChildAt(1).setX(ll.getChildAt(1).getX() + 30);
Toast.makeText(PCBcontext.getContext(),"Editar Picto", Toast.LENGTH_SHORT).show(); children = new ArrayList<>(Arrays.asList(new EditTextPicto(p),new EditImage(p)));
}
public void menuDisabled(){
ll.getChildAt(1).setX(ll.getChildAt(1).getX() - 30);
} }
} }
...@@ -1510,11 +1521,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1510,11 +1521,11 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; } public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; }
public void menuActiviated() public void menuActiviated()
{ {
Toast.makeText(PCBcontext.getContext(),"Editar Texto", Toast.LENGTH_SHORT).show();
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
((RelativeLayout)PieMenu.getParent()).removeView(PieMenu); ll.removeAllViewsInLayout();
createViewForExpression(this.p); createViewForExpression(this.p);
} }
public void menuDisabled(){}
} }
public class EditImage implements RadialMenuWidget.RadialMenuEntry public class EditImage implements RadialMenuWidget.RadialMenuEntry
...@@ -1532,6 +1543,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1532,6 +1543,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
/**TODO: Llamar a la interfaz de editar foto*/ /**TODO: Llamar a la interfaz de editar foto*/
Toast.makeText(PCBcontext.getContext(),"Editar Imagen", Toast.LENGTH_SHORT).show(); Toast.makeText(PCBcontext.getContext(),"Editar Imagen", Toast.LENGTH_SHORT).show();
} }
public void menuDisabled(){}
} }
......
...@@ -36,13 +36,15 @@ public class RadialMenuWidget extends View { ...@@ -36,13 +36,15 @@ public class RadialMenuWidget extends View {
int getIcon(); int getIcon();
List<RadialMenuEntry> getChildren(); List<RadialMenuEntry> getChildren();
void menuActiviated(); void menuActiviated();
void menuDisabled();
} }
private List<RadialMenuEntry> menuEntries = new ArrayList<RadialMenuEntry>(); private List<RadialMenuEntry> menuEntries = new ArrayList<RadialMenuEntry>();
private List<RadialMenuEntry> menuEntries2 = new ArrayList<RadialMenuEntry>(); private List<RadialMenuEntry> menuEntries2 = new ArrayList<RadialMenuEntry>();
private RadialMenuEntry centerCircle = null; private RadialMenuEntry centerCircle = null;
private int variable; private boolean pulsed = false;
private int variable; //For know which submenu button was click
private float screen_density = getContext().getResources().getDisplayMetrics().density; private float screen_density = getContext().getResources().getDisplayMetrics().density;
private int defaultColor = Color.rgb(221, 221, 211); //default color of wedge pieces private int defaultColor = Color.rgb(221, 221, 211); //default color of wedge pieces
...@@ -219,10 +221,11 @@ public class RadialMenuWidget extends View { ...@@ -219,10 +221,11 @@ public class RadialMenuWidget extends View {
if (enabled != null) { if (enabled != null) {
enabled = null; enabled = null;
animateOuterIn = true; //sets Wedge2Shown = false; animateOuterIn = true; //sets Wedge2Shown = false;
menuEntries.get(variable).menuDisabled();
//If outer ring is not enabled, then executes event //If outer ring is not enabled, then executes event
} else { } else {
menuEntries.get(i).menuActiviated(); menuEntries.get(i).menuActiviated();
variable = i; variable = i;
//Figures out how many outer rings //Figures out how many outer rings
if (menuEntries.get(i).getChildren() != null) { if (menuEntries.get(i).getChildren() != null) {
...@@ -239,16 +242,16 @@ public class RadialMenuWidget extends View { ...@@ -239,16 +242,16 @@ public class RadialMenuWidget extends View {
} }
} else if (selected2 != null){ } else if (selected2 != null){
for (int i = 0; i < Wedges2.length; i++) { for (int i = 0; i < Wedges2.length; i++) {
//for (int j = 0; j < menuEntries.get(i).getChildren().size(); j++) { Wedge f = Wedges2[i];
Wedge f = Wedges2[i]; if (f == selected2) {
if (f == selected2) { animateOuterIn = true; //sets Wedge2Shown = false;
animateOuterIn = true; //sets Wedge2Shown = false; enabled = null;
enabled = null; selected = null;
selected = null;
menuEntries.get(variable).getChildren().get(i).menuActiviated(); menuEntries.get(variable).getChildren().get(i).menuActiviated();
}
//} }
} }
} 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment