mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Render user's actual workspace in ThemePicker preview (Part 3)
go/grid-migration-preview With this change, we can see actual grid migration in wallpaper preview. The approach here: we use a tmp table (favorites_preview) here specifically for this preview (to write off the migration results), and load from this tmp table workspace items if migration is necessary and successful. Otherwise, we load from the current workspace. UPDATED: this change should be completely compatible with the new multi-db grid migration algorithm. Here is why 1. In LauncherPreviewRender#renderScreenShot, I added a check to decide which grid migration preview method we should call. Once v2 preview method is implemented, it should be integrated with other parts of this change perfectly (the reason will be mentioned below). 2. While we have multiple DBs, mOpenHelper in LauncherProvider always points to the current db we are using. Queries using CONTENT_URI is routed to whatever DB mOpenHelper points to, so it works perfectly to directly operate on CONTENT_URI even when we use multi-db underneath the hood. 3. With 1 and 2 mentioned, I believe in order for this preview change to support multi-db, we only need to implement the V2 grid migration algorithm. Because most of what we are doing in this change is wrapped in GridSizeMigrationTask, it's perfectly safeguarded. Bug: 144052839 Change-Id: Ie6d6048d77326f96546c8a180a7cd8f15b47e4c4
This commit is contained in:
@@ -18,6 +18,8 @@ package com.android.launcher3.model;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.launcher3.InvariantDeviceProfile;
|
||||
|
||||
/**
|
||||
* This class takes care of shrinking the workspace (by maximum of one row and one column), as a
|
||||
* result of restoring from a larger device or device density change.
|
||||
@@ -28,13 +30,20 @@ public class GridSizeMigrationTaskV2 {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrates the workspace and hotseat in case their sizes changed.
|
||||
*
|
||||
* @return false if the migration failed.
|
||||
*/
|
||||
/** See {@link #migrateGridIfNeeded(Context, InvariantDeviceProfile)} */
|
||||
public static boolean migrateGridIfNeeded(Context context) {
|
||||
// To be implemented.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migration algorithm if needed. For preview, we provide the intended idp because it
|
||||
* has not been changed. If idp is null, we read it from the context, for actual grid migration.
|
||||
*
|
||||
* @return false if the migration failed.
|
||||
*/
|
||||
public static boolean migrateGridIfNeeded(Context context, InvariantDeviceProfile idp) {
|
||||
// To be implemented.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user