mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Add UI updates for incremental app installs.
1. Changed Preload Icon UI to be grayscale while the app is not startable. 2. Added progress bar for when app is installed but still ownloading. 3. Updated Preload Icon progress and click handling to use new incremental api. Progress bar color updates will follow in a separate CL. Demo: https://drive.google.com/file/d/1H1EvtTorLeJwC1eiq10tm-TT81YZ6osk/view?usp=sharing Bug: 171008815 Test: manual Change-Id: I5874a5146d79a8c91d7d90ff0b9c1c427a3c95dd
This commit is contained in:
@@ -45,10 +45,11 @@ import android.widget.Toast;
|
||||
|
||||
import com.android.launcher3.PendingAddItemInfo;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.model.data.PromiseAppInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
@@ -200,9 +201,12 @@ public class PackageManagerHelper {
|
||||
* Starts the details activity for {@code info}
|
||||
*/
|
||||
public void startDetailsActivityForInfo(ItemInfo info, Rect sourceBounds, Bundle opts) {
|
||||
if (info instanceof PromiseAppInfo) {
|
||||
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
|
||||
mContext.startActivity(promiseAppInfo.getMarketIntent(mContext));
|
||||
if (info instanceof ItemInfoWithIcon
|
||||
&& (((ItemInfoWithIcon) info).runtimeStatusFlags
|
||||
& ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
|
||||
ItemInfoWithIcon appInfo = (ItemInfoWithIcon) info;
|
||||
mContext.startActivity(new PackageManagerHelper(mContext)
|
||||
.getMarketIntent(appInfo.getTargetComponent().getPackageName()));
|
||||
return;
|
||||
}
|
||||
ComponentName componentName = null;
|
||||
@@ -319,4 +323,12 @@ public class PackageManagerHelper {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Returns the incremental download progress for the given shortcut's app. */
|
||||
public static int getLoadingProgress(LauncherActivityInfo info) {
|
||||
if (Utilities.ATLEAST_S) {
|
||||
return (int) (100 * info.getLoadingProgress());
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user