use of io.virtualapp.home.models.MultiplePackageAppData in project VirtualApp by asLody.
the class AppRepository method getVirtualApps.
@Override
public Promise<List<AppData>, Throwable, Void> getVirtualApps() {
return VUiKit.defer().when(() -> {
List<InstalledAppInfo> infos = VirtualCore.get().getInstalledApps(0);
List<AppData> models = new ArrayList<>();
for (InstalledAppInfo info : infos) {
if (!VirtualCore.get().isPackageLaunchable(info.packageName)) {
continue;
}
PackageAppData data = new PackageAppData(mContext, info);
if (VirtualCore.get().isAppInstalledAsUser(0, info.packageName)) {
models.add(data);
}
int[] userIds = info.getInstalledUsers();
for (int userId : userIds) {
if (userId != 0) {
models.add(new MultiplePackageAppData(data, userId));
}
}
}
return models;
});
}
use of io.virtualapp.home.models.MultiplePackageAppData in project VirtualApp by asLody.
the class LaunchpadAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
AppData data = mList.get(position);
holder.color = getColor(position);
holder.iconView.setImageDrawable(data.getIcon());
holder.nameView.setText(data.getName());
if (data.isFirstOpen() && !data.isLoading()) {
holder.firstOpenDot.setVisibility(View.VISIBLE);
} else {
holder.firstOpenDot.setVisibility(View.INVISIBLE);
}
holder.itemView.setBackgroundColor(holder.color);
holder.itemView.setOnClickListener(v -> {
if (mAppClickListener != null) {
mAppClickListener.onAppClick(position, data);
}
});
if (data instanceof MultiplePackageAppData) {
MultiplePackageAppData multipleData = (MultiplePackageAppData) data;
holder.spaceLabelView.setVisibility(View.VISIBLE);
holder.spaceLabelView.setText(multipleData.userId + 1 + "");
} else {
holder.spaceLabelView.setVisibility(View.INVISIBLE);
}
if (data.isLoading()) {
startLoadingAnimation(holder.iconView);
} else {
holder.iconView.setProgress(100, false);
}
}
Aggregations