Search in sources :

Example 6 with UserCommand

use of com.google.android.apps.muzei.api.UserCommand in project muzei by romannurik.

the class SourceState method toJson.

public synchronized JSONObject toJson() throws JSONException {
    JSONObject jsonObject = new JSONObject();
    if (mCurrentArtwork != null) {
        jsonObject.put("currentArtwork", mCurrentArtwork.toJson());
    }
    jsonObject.put("description", mDescription);
    jsonObject.put("wantsNetworkAvailable", mWantsNetworkAvailable);
    JSONArray commandsSerialized = new JSONArray();
    for (UserCommand command : mUserCommands) {
        commandsSerialized.put(command.serialize());
    }
    jsonObject.put("userCommands", commandsSerialized);
    return jsonObject;
}
Also used : UserCommand(com.google.android.apps.muzei.api.UserCommand) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray)

Aggregations

UserCommand (com.google.android.apps.muzei.api.UserCommand)6 ComponentName (android.content.ComponentName)3 Cursor (android.database.Cursor)3 JSONArray (org.json.JSONArray)3 ContentResolver (android.content.ContentResolver)2 ContentValues (android.content.ContentValues)2 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 Bundle (android.os.Bundle)2 Artwork (com.google.android.apps.muzei.api.Artwork)2 ArrayList (java.util.ArrayList)2 JSONObject (org.json.JSONObject)2 PendingIntent (android.app.PendingIntent)1 ContentProviderOperation (android.content.ContentProviderOperation)1 OperationApplicationException (android.content.OperationApplicationException)1 PackageManager (android.content.pm.PackageManager)1 Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 Uri (android.net.Uri)1 RemoteException (android.os.RemoteException)1