Search in sources :

Example 6 with MultiplePackageAppData

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;
    });
}
Also used : MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) PackageAppData(io.virtualapp.home.models.PackageAppData) AppData(io.virtualapp.home.models.AppData) InstalledAppInfo(com.lody.virtual.remote.InstalledAppInfo) ArrayList(java.util.ArrayList) MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) PackageAppData(io.virtualapp.home.models.PackageAppData)

Example 7 with MultiplePackageAppData

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);
    }
}
Also used : MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData) AppData(io.virtualapp.home.models.AppData) MultiplePackageAppData(io.virtualapp.home.models.MultiplePackageAppData)

Aggregations

MultiplePackageAppData (io.virtualapp.home.models.MultiplePackageAppData)7 PackageAppData (io.virtualapp.home.models.PackageAppData)6 AppData (io.virtualapp.home.models.AppData)5 InstalledAppInfo (com.lody.virtual.remote.InstalledAppInfo)4 ArrayList (java.util.ArrayList)3 VirtualCore (com.lody.virtual.client.core.VirtualCore)2 VUserInfo (com.lody.virtual.os.VUserInfo)2 VUserManager (com.lody.virtual.os.VUserManager)2 InstallResult (com.lody.virtual.remote.InstallResult)2 VCommends (io.virtualapp.VCommends)2 VUiKit (io.virtualapp.abs.ui.VUiKit)2 AppInfoLite (io.virtualapp.home.models.AppInfoLite)2 PackageAppDataStorage (io.virtualapp.home.repo.PackageAppDataStorage)2 IOException (java.io.IOException)2 Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 Bitmap (android.graphics.Bitmap)1