2 * Copyright (C) 2017 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 package org.strongswan.android.ui.adapter;
18 import android.content.pm.ApplicationInfo;
19 import android.content.pm.PackageManager;
20 import android.graphics.drawable.Drawable;
21 import android.support.annotation.NonNull;
23 import java.text.Collator;
25 public class SelectedApplicationEntry implements Comparable<SelectedApplicationEntry>
27 private final ApplicationInfo mInfo;
28 private final Drawable mIcon;
29 private final String mName;
30 private boolean mSelected;
32 public SelectedApplicationEntry(PackageManager packageManager, ApplicationInfo info)
35 CharSequence name = info.loadLabel(packageManager);
36 mName = name == null ? info.packageName : name.toString();
37 mIcon = info.loadIcon(packageManager);
40 public void setSelected(boolean selected)
45 public boolean isSelected()
50 public ApplicationInfo getInfo()
55 public Drawable getIcon()
61 public String toString()
67 public int compareTo(@NonNull SelectedApplicationEntry another)
69 return Collator.getInstance().compare(toString(), another.toString());