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 {
StringBuffer txt = new StringBuffer();
if (words.length == 1) {
if (words[0].length() > 10) {
if (words[0].length() >= 11) {
texto = "";
int mitad = (words[0].length() / 2) - 1;
for(int i = 0 ; i<words[0].length();i++){
texto += words[0].charAt(i);
if(i==10) break;
}
/*int mitad = (words[0].length() / 2) - 1;
char r = words[0].charAt(mitad);
char r2 = words[0].charAt(mitad + 1);
......@@ -74,9 +77,11 @@ public class PictoItemViewGenerator {
txt.append(words[0].charAt(i));
i++;
}
texto = txt.toString();
texto = txt.toString();*/
}
}else{
texto = words[0];
}
return texto;
}
......@@ -94,7 +99,7 @@ public class PictoItemViewGenerator {
int height = bitmap.getHeight(); //Alto original
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();
if (bitmapConfig == null) {
......@@ -123,7 +128,7 @@ public class PictoItemViewGenerator {
textView.setDrawingCacheEnabled(true);
canvas.drawBitmap(textView.getDrawingCache(), 0, 50, null);
}else{
}else{*/
//Only legend
android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig();
if (bitmapConfig == null) {
......@@ -151,7 +156,7 @@ public class PictoItemViewGenerator {
canvas.drawBitmap(textView.getDrawingCache(), 0, 25, null);
}
}
//}
return bitmap;
}
......@@ -168,23 +173,28 @@ public class PictoItemViewGenerator {
FrameLayout layout ;
final ImageView pictoImage ;
ImageView redCrossImage ;
TextView legend;
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout_big);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image_big);
redCrossImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_redcross_big);
legend = (TextView) convertView.findViewById(R.id.legend_text_big);
} else
{
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper);
layout = (FrameLayout) convertView.findViewById(R.id.picto_grid_item_layout);
pictoImage = (ImageView) convertView.findViewById(R.id.picto_grid_item_image);
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.setAlpha(PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ? 0.25f : 0);
layout.setBackgroundColor(convertView.getResources()
.getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE);
// pictoImage.setVisibility(View.GONE);
// layoutWrapper.setVisibility(View.GONE);
if (picto == null) {
......@@ -194,6 +204,7 @@ public class PictoItemViewGenerator {
.getDrawable(R.drawable.picto_grid_item_border));
}
legend.setVisibility(View.GONE);
} else {
if (!picto.is_invisible()) {
layoutWrapper.setAlpha(1.00f);
......@@ -203,7 +214,14 @@ public class PictoItemViewGenerator {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
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);
......
......@@ -19,6 +19,18 @@
android:layout_width="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
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -19,6 +19,18 @@
android:layout_width="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
android:layout_width="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