Search in sources :

Example 1 with AbstractSelectAppActivity

use of com.farmerbb.taskbar.activity.AbstractSelectAppActivity in project Taskbar by farmerbb.

the class DesktopIconAppListAdapter method getView.

@Override
public View getView(int position, View convertView, final ViewGroup parent) {
    // Check if an existing view is being reused, otherwise inflate the view
    if (convertView == null)
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.tb_desktop_icon_row, parent, false);
    final AppEntry entry = getItem(position);
    assert entry != null;
    TextView textView = convertView.findViewById(R.id.name);
    textView.setText(entry.getLabel());
    ImageView imageView = convertView.findViewById(R.id.icon);
    imageView.setImageDrawable(entry.getIcon(getContext()));
    LinearLayout layout = convertView.findViewById(R.id.entry);
    layout.setOnClickListener(view -> {
        AbstractSelectAppActivity activity = (AbstractSelectAppActivity) getContext();
        activity.selectApp(entry);
    });
    return convertView;
}
Also used : AppEntry(com.farmerbb.taskbar.util.AppEntry) TextView(android.widget.TextView) ImageView(android.widget.ImageView) AbstractSelectAppActivity(com.farmerbb.taskbar.activity.AbstractSelectAppActivity) LinearLayout(android.widget.LinearLayout)

Aggregations

ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 AbstractSelectAppActivity (com.farmerbb.taskbar.activity.AbstractSelectAppActivity)1 AppEntry (com.farmerbb.taskbar.util.AppEntry)1