Commit 614b18cc by German Callejas

Solucionado el tema de las leyendas para que aparezcan en 1 linea

parent 51957801
...@@ -44,10 +44,13 @@ public class PictoItemViewGenerator { ...@@ -44,10 +44,13 @@ public class PictoItemViewGenerator {
StringBuffer txt = new StringBuffer(); StringBuffer txt = new StringBuffer();
if (words.length == 1) { if (words.length == 1) {
if (words[0].length() > 10) { if (words[0].length() >= 11) {
texto = ""; texto = "";
for(int i = 0 ; i<words[0].length();i++){
int mitad = (words[0].length() / 2) - 1; texto += words[0].charAt(i);
if(i==10) break;
}
/*int mitad = (words[0].length() / 2) - 1;
char r = words[0].charAt(mitad); char r = words[0].charAt(mitad);
char r2 = words[0].charAt(mitad + 1); char r2 = words[0].charAt(mitad + 1);
...@@ -74,9 +77,11 @@ public class PictoItemViewGenerator { ...@@ -74,9 +77,11 @@ public class PictoItemViewGenerator {
txt.append(words[0].charAt(i)); txt.append(words[0].charAt(i));
i++; i++;
} }
texto = txt.toString(); texto = txt.toString();*/
} }
}else{
texto = words[0];
} }
return texto; return texto;
} }
...@@ -94,7 +99,7 @@ public class PictoItemViewGenerator { ...@@ -94,7 +99,7 @@ public class PictoItemViewGenerator {
int height = bitmap.getHeight(); //Alto original int height = bitmap.getHeight(); //Alto original
String texto = format_legend(picto); String texto = format_legend(picto);
if(picto.get_legend().equals("normal")) { //Normal legend /*if(picto.get_legend().equals("normal")) { //Normal legend
android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig(); android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig();
if (bitmapConfig == null) { if (bitmapConfig == null) {
...@@ -123,7 +128,7 @@ public class PictoItemViewGenerator { ...@@ -123,7 +128,7 @@ public class PictoItemViewGenerator {
textView.setDrawingCacheEnabled(true); textView.setDrawingCacheEnabled(true);
canvas.drawBitmap(textView.getDrawingCache(), 0, 50, null); canvas.drawBitmap(textView.getDrawingCache(), 0, 50, null);
}else{ }else{*/
//Only legend //Only legend
android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig(); android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig();
if (bitmapConfig == null) { if (bitmapConfig == null) {
...@@ -151,7 +156,7 @@ public class PictoItemViewGenerator { ...@@ -151,7 +156,7 @@ public class PictoItemViewGenerator {
canvas.drawBitmap(textView.getDrawingCache(), 0, 25, null); canvas.drawBitmap(textView.getDrawingCache(), 0, 25, null);
} }
} //}
return bitmap; return bitmap;
} }
...@@ -168,25 +173,30 @@ public class PictoItemViewGenerator { ...@@ -168,25 +173,30 @@ public class PictoItemViewGenerator {
FrameLayout layout ; FrameLayout layout ;
final ImageView pictoImage ; final ImageView pictoImage ;
ImageView redCrossImage ; ImageView redCrossImage ;
TextView legend;
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) { if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big); layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout_big); layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout_big);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image_big); pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image_big);
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);
} 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);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross); redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross);
legend = (TextView) convertView.findViewById(R.id.legend_text);
//legend.setHeight((int) legend.getTextSize() + 2);
} }
layoutWrapper.setBackground(null); layoutWrapper.setBackground(null);
layoutWrapper.setAlpha(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0); layoutWrapper.setAlpha(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0);
layout.setBackgroundColor(convertView.getResources() 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); // pictoImage.setVisibility(View.GONE);
// layoutWrapper.setVisibility(View.GONE);
if (picto == null) { if (picto == null) {
pictoImage.setImageBitmap(null); pictoImage.setImageBitmap(null);
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) { if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
...@@ -194,6 +204,7 @@ public class PictoItemViewGenerator { ...@@ -194,6 +204,7 @@ public class PictoItemViewGenerator {
.getDrawable(R.drawable.picto_grid_item_border)); .getDrawable(R.drawable.picto_grid_item_border));
} }
legend.setVisibility(View.GONE);
} else { } else {
if (!picto.is_invisible()) { if (!picto.is_invisible()) {
layoutWrapper.setAlpha(1.00f); layoutWrapper.setAlpha(1.00f);
...@@ -203,7 +214,14 @@ public class PictoItemViewGenerator { ...@@ -203,7 +214,14 @@ public class PictoItemViewGenerator {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext()); Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
if(!picto.get_legend().equals("none")) { if(!picto.get_legend().equals("none")) {
bm = set_legend(PCBcontext.getContext(),bm,picto); if(picto.get_legend().equals("normal")){
legend.setText(format_legend(picto));
legend.setVisibility(View.VISIBLE);
}else {
bm = set_legend(PCBcontext.getContext(), bm, picto);
}
}else{
legend.setVisibility(View.GONE);
} }
pictoImage.setImageBitmap(bm); pictoImage.setImageBitmap(bm);
......
...@@ -19,6 +19,18 @@ ...@@ -19,6 +19,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<TextView
android:text="Legend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/legend_text"
android:textSize="11sp"
android:textColor="@android:color/black"
android:layout_gravity="bottom"
android:textAlignment="center"
android:visibility="gone"
android:background="@android:color/white" />
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
......
...@@ -19,6 +19,18 @@ ...@@ -19,6 +19,18 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<TextView
android:text="Legend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/legend_text_big"
android:textSize="13sp"
android:textColor="@android:color/black"
android:layout_gravity="bottom"
android:textAlignment="center"
android:visibility="gone"
android:background="@android:color/white" />
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
......
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