issue #849, #850 closed

parent 7b3c5765
...@@ -24,6 +24,10 @@ public class User { ...@@ -24,6 +24,10 @@ public class User {
return this.get_id_sup()!=User.NO_SUPERVISOR; return this.get_id_sup()!=User.NO_SUPERVISOR;
} }
public String getOffice() {
return null;
}
public final static class JSON_STUDENT_ATTTRS{ public final static class JSON_STUDENT_ATTTRS{
static String CATEGORIES = "categories"; static String CATEGORIES = "categories";
static String INPUT_FEEDBACK = "input_feedback"; static String INPUT_FEEDBACK = "input_feedback";
......
...@@ -29,7 +29,9 @@ import java.util.ArrayList; ...@@ -29,7 +29,9 @@ import java.util.ArrayList;
public class PictoItemViewGenerator { public class PictoItemViewGenerator {
public static final int LAYOUT = R.layout.picto_grid_item; public static final int LAYOUT = R.layout.picto_grid_item;
public static final int LAYOUT_BIG = R.layout.picto_grid_item_big; public static final int LAYOUT_BIG = R.layout.picto_grid_item_big;
private static final byte MAX_LINE_LENGTH = 7; private static final byte MAX_LINE_LENGTH = 9;
private static final byte MAX_LINE_LENGTH_FULL = 7;
private static final String LOG_TAG = PictoItemViewGenerator.class.getCanonicalName();
public static int mirror_color=0; public static int mirror_color=0;
...@@ -155,8 +157,7 @@ public class PictoItemViewGenerator { ...@@ -155,8 +157,7 @@ public class PictoItemViewGenerator {
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross_big); redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross_big);
legend = (TextView) convertView.findViewById(R.id.legend_text_big); legend = (TextView) convertView.findViewById(R.id.legend_text_big);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_big_full); legend_full = (TextView) convertView.findViewById(R.id.legend_text_big_full);
} else } else {
{
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper); layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout); layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image); pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image);
...@@ -164,82 +165,66 @@ public class PictoItemViewGenerator { ...@@ -164,82 +165,66 @@ public class PictoItemViewGenerator {
legend = (TextView) convertView.findViewById(R.id.legend_text); legend = (TextView) convertView.findViewById(R.id.legend_text);
legend_full = (TextView) convertView.findViewById(R.id.legend_text_full); legend_full = (TextView) convertView.findViewById(R.id.legend_text_full);
} }
layoutWrapper.setBackground(null); layout.setBackgroundColor(convertView.getResources()
layoutWrapper.setAlpha(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0);
layout.setBackgroundColor(convertView.getResources()
.getColor(R.color.picto_default_background)); .getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE); redCrossImage.setVisibility(View.GONE);
// pictoImage.setVisibility(View.GONE);
// layoutWrapper.setVisibility(View.GONE); if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
if (picto == null) { layoutWrapper.setVisibility(View.VISIBLE);
pictoImage.setImageBitmap(null); pictoImage.setVisibility(View.VISIBLE);
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) { layoutWrapper.setBackground(convertView.getResources()
layoutWrapper.setBackground(convertView.getResources() .getDrawable(R.drawable.picto_grid_item_border));
.getDrawable(R.drawable.picto_grid_item_border)); } else if (picto == null || picto.is_invisible() ) {
layoutWrapper.setVisibility(View.GONE);
} pictoImage.setVisibility(View.GONE);
legend.setVisibility(View.GONE); legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE); legend_full.setVisibility(View.GONE);
} else { }
legend.setText(format_legend(picto,MAX_LINE_LENGTH+2));
legend_full.setText(format_legend(picto,MAX_LINE_LENGTH));
if (!picto.is_invisible()) {
layoutWrapper.setAlpha(1.00f);
}
try {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
if(!picto.get_legend().equals("none")) {
if(picto.get_legend().equals("normal")){
if( picto!=null) {
layoutWrapper.setAlpha(!picto.is_invisible() ? 1.00f : PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0f );
try {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
switch (picto.get_legend()) {
case "none":
legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE);
break;
case "normal":
legend.setText(format_legend(picto,MAX_LINE_LENGTH));
legend.setVisibility(View.VISIBLE); legend.setVisibility(View.VISIBLE);
legend_full.setVisibility(View.GONE); legend_full.setVisibility(View.GONE);
break;
}else { default:
legend_full.setText(format_legend(picto,MAX_LINE_LENGTH_FULL));
legend.setVisibility(View.GONE); legend.setVisibility(View.GONE);
legend_full.setVisibility(View.VISIBLE); legend_full.setVisibility(View.VISIBLE);
}
}else{
legend.setVisibility(View.GONE);
legend_full.setVisibility(View.GONE);
} }
pictoImage.setImageBitmap(bm); pictoImage.setImageBitmap(bm);
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());
}
if (picto.is_mirror() && !preventMirror) {
int color[]={Color.WHITE,Color.LTGRAY,Color.GRAY,Color.DKGRAY,Color.BLACK,Color.DKGRAY,Color.GRAY,Color.LTGRAY,Color.WHITE};
float scale[]={1f,1.1f,1.2f,1.3f,1.4f,1.5f,1.4f,1.3f,1.2f,1.1f};
mirror_color++;
pictoImage.setScaleX(scale[mirror_color%scale.length]);
pictoImage.setScaleY(scale[mirror_color%scale.length]);
if (picto.is_highlight_background()) layout.setBackgroundColor(color[mirror_color%color.length]);
}
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());
if (picto.is_mirror() && !preventMirror) {
int color[]={Color.WHITE,Color.LTGRAY,Color.GRAY,Color.DKGRAY,Color.BLACK,Color.DKGRAY,Color.GRAY,Color.LTGRAY,Color.WHITE};
float scale[]={1f,1.1f,1.2f,1.3f,1.4f,1.5f,1.4f,1.3f,1.2f,1.1f};
mirror_color++;
pictoImage.setScaleX(scale[mirror_color%scale.length]);
pictoImage.setScaleY(scale[mirror_color%scale.length]);
if (picto.is_highlight_background()) layout.setBackgroundColor(color[mirror_color%color.length]);
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -505,10 +505,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -505,10 +505,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
"{\"magnify\":false,\"highlight\":false,\"coord_y\":1,\"id_cat\":12303,\"status\":\"invisible\",\"coord_x\":4}"); "{\"magnify\":false,\"highlight\":false,\"coord_y\":1,\"id_cat\":12303,\"status\":\"invisible\",\"coord_x\":4}");
*/ */
for (int i = 0; i < maxRows; i++) { for (int i = 0; i < maxRows; i++)
for (int j = 0; j < maxColumns; j++) for (int j = 0; j < maxColumns; j++)
ll.add(mp[i][j]); ll.add(mp[i][j]);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -1021,7 +1020,7 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1021,7 +1020,7 @@ protected void showOnlyTape(boolean onlyTape) {
firstTouchX = event.getX(); firstTouchX = event.getX();
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 100) { //izquierda a derecha if (event.getX() > firstTouchX + 150) { //izquierda a derecha
if (!student_view) { if (!student_view) {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR); PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
nextActivity = intent; nextActivity = intent;
...@@ -1032,8 +1031,8 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1032,8 +1031,8 @@ protected void showOnlyTape(boolean onlyTape) {
in = R.anim.rightin; in = R.anim.rightin;
out = R.anim.rightout; out = R.anim.rightout;
overridePendingTransition(R.anim.leftin, R.anim.leftout); overridePendingTransition(R.anim.leftin, R.anim.leftout);
} else if (firstTouchX > event.getX() + 100) { //derecha a izquierda } else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!student_view) { if (!student_view ) {
nextActivity = new Intent(this, SessionActivity.class); nextActivity = new Intent(this, SessionActivity.class);
} else { } else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId()); PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId());
......
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