mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Refactoring some loadWorkspace logic in a separate class
Bug: 34112546 Change-Id: I8a43ed1646056aa1957ac3d6ea82018691df6386
This commit is contained in:
@@ -20,6 +20,7 @@ import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
@@ -35,9 +36,15 @@ public class ContentWriter {
|
||||
private final ContentValues mValues;
|
||||
private final Context mContext;
|
||||
|
||||
private CommitParams mCommitParams;
|
||||
private Bitmap mIcon;
|
||||
private UserHandle mUser;
|
||||
|
||||
public ContentWriter(Context context, CommitParams commitParams) {
|
||||
this(context);
|
||||
mCommitParams = commitParams;
|
||||
}
|
||||
|
||||
public ContentWriter(Context context) {
|
||||
this(new ContentValues(), context);
|
||||
}
|
||||
@@ -95,4 +102,25 @@ public class ContentWriter {
|
||||
}
|
||||
return mValues;
|
||||
}
|
||||
|
||||
public int commit() {
|
||||
if (mCommitParams != null) {
|
||||
return mContext.getContentResolver().update(mCommitParams.mUri, getValues(),
|
||||
mCommitParams.mWhere, mCommitParams.mSelectionArgs);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final class CommitParams {
|
||||
|
||||
final Uri mUri = LauncherSettings.Favorites.CONTENT_URI;
|
||||
String mWhere;
|
||||
String[] mSelectionArgs;
|
||||
|
||||
public CommitParams(String where, String[] selectionArgs) {
|
||||
mWhere = where;
|
||||
mSelectionArgs = selectionArgs;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user