com.google.android.apps.muzei.api.UserCommand Java Examples
The following examples show how to use
com.google.android.apps.muzei.api.UserCommand.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PixivArtProvider.java From PixivforMuzei3 with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("deprecation") @Override @NonNull public List<UserCommand> getCommands(@NonNull Artwork artwork) { super.getCommands(artwork); if (!running) { return Collections.emptyList(); } LinkedList<UserCommand> commands = new LinkedList<>(); // Android 10 limits the ability for activities to run in the background if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) { Context context = checkContext(); UserCommand addToBookmark = new UserCommand(COMMAND_ADD_TO_BOOKMARKS, context.getString(R.string.command_addToBookmark)); commands.add(addToBookmark); UserCommand openIntentImage = new UserCommand(COMMAND_VIEW_IMAGE_DETAILS, context.getString(R.string.command_viewArtworkDetails)); UserCommand shareImage = new UserCommand(COMMAND_SHARE_IMAGE, context.getString(R.string.command_shareImage)); commands.add(shareImage); commands.add(openIntentImage); } return commands; }
Example #2
Source File: MysplashMuzeiArtSource.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
private void publishPhoto(@NonNull Photo photo) { publishArtwork( new Artwork.Builder() .title(getString(R.string.by) + " " + photo.user.name) .byline(getString(R.string.on) + " " + photo.created_at.split("T")[0]) .imageUri(Uri.parse(photo.getDownloadUrl(getApplicationContext()))) .token(photo.id) .viewIntent( RoutingHelper.getWebActivityIntent( "https://unsplash.com/photos/" + photo.id) ).build() ); List<UserCommand> commands = new ArrayList<>(); commands.add(new UserCommand(MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK)); setUserCommands(commands); }
Example #3
Source File: BiliWallpaperSource.java From muzei-bilibili with Apache License 2.0 | 5 votes |
@Override protected void onUpdate(int reason) { List<UserCommand> commands = new ArrayList<>(); if (reason == UPDATE_REASON_INITIAL) { // Show initial picture final File file = getCacheFile("66138"); saveInitialPicture(file); if (file.exists()) { publishArtwork(new Artwork.Builder() .imageUri(Uri.fromFile(file)) .title("22&33") .token("66138") .byline("Bilibili壁纸娘\n动漫") .viewIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("http://h.bilibili.com/wallpaper?action=detail&il_id=66138"))) .build()); // show the latest photo in 15 minutes scheduleUpdate(System.currentTimeMillis() + 15 * 60 * 1000); } else { super.onUpdate(reason); } } else { super.onUpdate(reason); } commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK)); commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.action_share))); commands.add(new UserCommand(COMMAND_ID_VIEW_MORE, getString(R.string.view_more_info))); setUserCommands(commands); }