Muzei live wallpaper is a new opensource project from Roman Nurik which provide a nice API for other developers to build extension on it easily. Just a few days after its release on Feb 12, you can already find quite many different data source for it. So I played for a while today and found that it is… really easy to implement your own data source.
Here is a quick start on creating the extension.
1234567891011121314151617181920212223242526272829
publicclassMyArtSourceextendsRemoteMuzeiArtSource{privatestaticfinalintUPDATE_INTERVAL=60*60*1000;// 60minpublicMyArtSource(){super("my-art-source");}@OverridepublicvoidonCreate(){super.onCreate();setUserCommands(BUILTIN_COMMAND_ID_NEXT_ARTWORK);// manual switch image}@OverrideprotectedvoidonTryUpdate(intreason)throwsRetryException{// fetch title, imageUrl, id, url from remote or hardcodepublishArtwork(newArtwork.Builder().title(title).imageUri(Uri.parse(imageUrl)).token(id).viewIntent(newIntent(Intent.ACTION_VIEW,Uri.parse(url))).build());scheduleUpdate(System.currentTimeMillis()+UPDATE_INTERVAL);// switch image after 60min}}
You can find my Muzei 9GAG extension on Play store, source code available on Github