diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-01-05 21:50:27 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-01-10 13:53:50 -0800 |
commit | aaf86fe9a0406720cca7cfe204f28e2d2de085eb (patch) | |
tree | cc3c034548692ac963545d9eb11dc5742099ff74 /src/com/android/launcher3/util/ContentWriter.java | |
parent | e09bacc1ef50aa7c4fe551a7360d7f5613927ee9 (diff) | |
download | android_packages_apps_Trebuchet-aaf86fe9a0406720cca7cfe204f28e2d2de085eb.tar.gz android_packages_apps_Trebuchet-aaf86fe9a0406720cca7cfe204f28e2d2de085eb.tar.bz2 android_packages_apps_Trebuchet-aaf86fe9a0406720cca7cfe204f28e2d2de085eb.zip |
Refactoring some loadWorkspace logic in a separate class
Bug: 34112546
Change-Id: I8a43ed1646056aa1957ac3d6ea82018691df6386
Diffstat (limited to 'src/com/android/launcher3/util/ContentWriter.java')
-rw-r--r-- | src/com/android/launcher3/util/ContentWriter.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/launcher3/util/ContentWriter.java b/src/com/android/launcher3/util/ContentWriter.java index 1c347c0a4..76ba9d63a 100644 --- a/src/com/android/launcher3/util/ContentWriter.java +++ b/src/com/android/launcher3/util/ContentWriter.java @@ -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; + } + + } } |