Revert "Improving performance unsing compoundDrawable in NodeAdapter"
This reverts commit bf177ace64
.
This commit is contained in:
parent
5ca9a6431e
commit
79ce86ac24
@ -1,21 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/widget44"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_x="201px"
|
||||
android:layout_y="165px"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/icon_text"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/widget44"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:maxLines="2"
|
||||
android:textColor="@android:color/black"
|
||||
android:textColorHighlight="#656565" >
|
||||
android:orientation="vertical"
|
||||
android:layout_x="201px"
|
||||
android:layout_y="165px"
|
||||
android:gravity="center_horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/icon_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</ImageView>
|
||||
<TextView
|
||||
android:id="@+id/icon_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:gravity="center_horizontal"
|
||||
android:textColorHighlight="#656565"
|
||||
android:textColor="@android:color/black"
|
||||
>
|
||||
</TextView>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -23,6 +23,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import es.ugr.swad.swadroid.R;
|
||||
@ -47,6 +48,7 @@ public class NodeAdapter extends BaseAdapter {
|
||||
|
||||
static class ViewHolder {
|
||||
TextView text;
|
||||
ImageView image;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,18 +84,28 @@ public class NodeAdapter extends BaseAdapter {
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.text = (TextView) convertView.findViewById(R.id.icon_text);
|
||||
holder.image = (ImageView) convertView.findViewById(R.id.icon_image);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
// Trying to use ellipsizing only when it is needed, it does not work
|
||||
/*
|
||||
*
|
||||
String nodeName = ((DirectoryItem)list.get(position)).getName();
|
||||
if(!isTooLarge(holder.text,nodeName))
|
||||
holder.text.setEllipsize(null); //if the text fits in two lines, the ellipsizing is turn off
|
||||
else
|
||||
holder.text.setEllipsize(TextUtils.TruncateAt.END); //if the text does not fit in two lines, the ellipsizing is set to end
|
||||
*/
|
||||
|
||||
holder.text.setText(list.get(position).getName());
|
||||
|
||||
if (list.get(position).isFolder()) {
|
||||
holder.text.setCompoundDrawablesRelativeWithIntrinsicBounds(0, R.drawable.folder_open, 0, 0);
|
||||
holder.image.setImageResource(R.drawable.folder_open);
|
||||
} else {
|
||||
holder.text.setCompoundDrawablesRelativeWithIntrinsicBounds(0, R.drawable.file, 0, 0);
|
||||
holder.image.setImageResource(R.drawable.file);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
|
Loading…
Reference in New Issue
Block a user