本文整理汇总了Java中com.google.android.apps.muzei.api.UserCommand类的典型用法代码示例。如果您正苦于以下问题:Java UserCommand类的具体用法?Java UserCommand怎么用?Java UserCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserCommand类属于com.google.android.apps.muzei.api包,在下文中一共展示了UserCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: exportPhoto
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
private void exportPhoto(@Nullable Photo photo) {
if (photo != null) {
Intent intent = new Intent(this, PhotoActivity.class);
intent.putExtra(PhotoActivity.KEY_PHOTO_ACTIVITY_ID, photo.id);
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.getWallpaperSizeUrl(this)))
.token(photo.id)
.viewIntent(intent)
.build());
List<UserCommand> commands = new ArrayList<>();
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
setUserCommands(commands);
}
}
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:20,代码来源:MuzeiSourceService.java
示例2: fromBundle
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
public static SourceState fromBundle(Bundle bundle) {
SourceState state = new SourceState();
Bundle artworkBundle = bundle.getBundle("currentArtwork");
if (artworkBundle != null) {
state.mCurrentArtwork = Artwork.fromBundle(artworkBundle);
}
state.mDescription = bundle.getString("description");
state.mWantsNetworkAvailable = bundle.getBoolean("wantsNetworkAvailable");
String[] commandsSerialized = bundle.getStringArray("userCommands");
if (commandsSerialized != null && commandsSerialized.length > 0) {
state.mUserCommands.ensureCapacity(commandsSerialized.length);
for (String s : commandsSerialized) {
state.mUserCommands.add(UserCommand.deserialize(s));
}
}
return state;
}
开发者ID:tasomaniac,项目名称:MuzeiEarthView,代码行数:18,代码来源:SourceState.java
示例3: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Injector.obtain(this).inject(this);
List<UserCommand> commands = new ArrayList<>();
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.action_share_artwork)));
commands.add(new UserCommand(COMMAND_ID_DOWNLOAD, getString(R.string.action_download)));
commands.add(new UserCommand(COMMAND_ID_VIEW_IN_GOOGLE_MAPS, getString(R.string.action_view_in_google_maps)));
if (BuildConfig.DEBUG) {
commands.add(new UserCommand(COMMAND_ID_DEBUG_INFO, "Debug info"));
}
setUserCommands(commands);
}
开发者ID:tasomaniac,项目名称:MuzeiEarthView,代码行数:17,代码来源:EarthViewArtSource.java
示例4: getUserCommands
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Test
public void getUserCommands() {
// When
List<UserCommand> userCommands = sut.getUserCommands();
// Then
assertEquals(BuildConfig.DEBUG ? 3 : 2, userCommands.size());
if (BuildConfig.DEBUG) {
assertEquals(ArtSourceService.COMMAND_ID_DEBUG_INFO, userCommands.get(0).getId());
assertEquals(ArtSourceService.COMMAND_ID_SHARE, userCommands.get(1).getId());
assertEquals(MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK, userCommands.get(2).getId());
} else {
assertEquals(ArtSourceService.COMMAND_ID_SHARE, userCommands.get(0).getId());
assertEquals(MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK, userCommands.get(1).getId());
}
}
开发者ID:mainthread-technology,项目名称:grand-maps-for-muzei,代码行数:17,代码来源:GrandMapsArtSourceServiceTest.java
示例5: triggerUserCommandFromRemoteInput
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
private void triggerUserCommandFromRemoteInput(final Context context, Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput == null) {
return;
}
final String selectedCommand = remoteInput.getCharSequence(EXTRA_USER_COMMAND).toString();
final PendingResult pendingResult = goAsync();
final LiveData<Source> sourceLiveData = MuzeiDatabase.getInstance(context).sourceDao().getCurrentSource();
sourceLiveData.observeForever(new Observer<Source>() {
@Override
public void onChanged(@Nullable final Source selectedSource) {
sourceLiveData.removeObserver(this);
if (selectedSource != null) {
for (UserCommand action : selectedSource.commands) {
if (TextUtils.equals(selectedCommand, action.getTitle())) {
SourceManager.sendAction(context, action.getId());
break;
}
pendingResult.finish();
}
}
}
});
}
开发者ID:romannurik,项目名称:muzei,代码行数:25,代码来源:NewWallpaperNotificationReceiver.java
示例6: onChanged
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onChanged(@Nullable final Source source) {
// Update overflow and next button
mOverflowSourceActionMap.clear();
mOverflowMenu.getMenu().clear();
mOverflowMenu.inflate(R.menu.muzei_overflow);
if (source != null) {
mSupportsNextArtwork = source.supportsNextArtwork;
List<UserCommand> commands = source.commands;
int numSourceActions = Math.min(SOURCE_ACTION_IDS.length,
commands.size());
for (int i = 0; i < numSourceActions; i++) {
UserCommand action = commands.get(i);
mOverflowSourceActionMap.put(SOURCE_ACTION_IDS[i], action.getId());
mOverflowMenu.getMenu().add(0, SOURCE_ACTION_IDS[i], 0, action.getTitle());
}
}
mNextButton.setVisibility(mSupportsNextArtwork && !mArtworkLoading ? View.VISIBLE : View.GONE);
}
开发者ID:romannurik,项目名称:muzei,代码行数:20,代码来源:ArtDetailFragment.java
示例7: fromString
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@TypeConverter
@NonNull
public static List<UserCommand> fromString(String commandsString) {
ArrayList<UserCommand> commands = new ArrayList<>();
if (TextUtils.isEmpty(commandsString)) {
return commands;
}
try {
JSONArray commandArray = new JSONArray(commandsString);
for (int h=0; h<commandArray.length(); h++) {
commands.add(UserCommand.deserialize(commandArray.getString(h)));
}
} catch (JSONException e) {
Log.e(TAG, "Error parsing commands from " + commandsString, e);
}
return commands;
}
开发者ID:romannurik,项目名称:muzei,代码行数:18,代码来源:UserCommandTypeConverter.java
示例8: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
prefs = PreferenceManager.getDefaultSharedPreferences(this);
isRandom = prefs.getBoolean(getString(R.string.pref_cyclemode_key), true);
isRefreshOnWifiOnly = prefs.getBoolean(getString(R.string.pref_wifiswitch_key), false);
List<UserCommand> userCommands = new ArrayList<>(2);
if (isRandom) {
userCommands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
}
userCommands.add(new UserCommand(USER_COMMAND_ID_SHARE, getString(R.string.share_artwork_title)));
userCommands.add(new UserCommand(USER_COMMAND_ID_PHOTO_DESCRIPTION, getString(R.string.photo_desc_open)));
setUserCommands(userCommands);
}
开发者ID:msal,项目名称:muzei-nationalgeographic,代码行数:17,代码来源:NationalGeographicArtSource.java
示例9: setUserCommands
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
public synchronized void setUserCommands(int... userCommands) {
mUserCommands.clear();
if (userCommands != null) {
mUserCommands.ensureCapacity(userCommands.length);
for (int command : userCommands) {
mUserCommands.add(new UserCommand(command));
}
}
}
开发者ID:tasomaniac,项目名称:MuzeiEarthView,代码行数:10,代码来源:SourceState.java
示例10: toJson
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
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;
}
开发者ID:tasomaniac,项目名称:MuzeiEarthView,代码行数:15,代码来源:SourceState.java
示例11: onUpdate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@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);
}
开发者ID:Bilibili,项目名称:muzei-bilibili,代码行数:31,代码来源:BiliWallpaperSource.java
示例12: getUserCommands
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public List<UserCommand> getUserCommands() {
List<UserCommand> commands = new ArrayList<>();
if (BuildConfig.DEBUG) {
// Displays the next scheduled update time.
commands.add(new UserCommand(COMMAND_ID_DEBUG_INFO, "Update Info"));
}
commands.add(new UserCommand(COMMAND_ID_SHARE, resources.getString(R.string.action_share)));
commands.add(new UserCommand(MuzeiArtSource.BUILTIN_COMMAND_ID_NEXT_ARTWORK));
return commands;
}
开发者ID:mainthread-technology,项目名称:grand-maps-for-muzei,代码行数:15,代码来源:GrandMapsArtSourceService.java
示例13: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mPrefs = new Preferences(MuzeiArtSourceService.this);
ArrayList<UserCommand> commands = new ArrayList<>();
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.share)));
setUserCommands(commands);
}
开发者ID:PitchedApps,项目名称:Material-Glass,代码行数:10,代码来源:MuzeiArtSourceService.java
示例14: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
UserCommand nextArtworkCommand = new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK);
UserCommand shareCommand = new UserCommand(CUSTOM_COMMAND_ID_SHARE, "Share photo");
setUserCommands(nextArtworkCommand, shareCommand);
}
开发者ID:kahluagenie,项目名称:muzei-gopro,代码行数:8,代码来源:GoProPotdArtSource.java
示例15: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
public void onCreate()
{
if(DEBUG)Log.w(TAG, "onCreate");
super.onCreate();
ArrayList<UserCommand> commands = new ArrayList<UserCommand>();
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.action_share_app)));
setUserCommands(commands);
PreferenceHelper.limitConfigFreq(this);
}
开发者ID:R3CONN3R,项目名称:MuzeiWallpaper,代码行数:14,代码来源:WallSource.java
示例16: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
List<UserCommand> commands = new ArrayList<UserCommand>();
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.action_share_artwork)));
commands.add(new UserCommand(COMMAND_ID_DOWNLOAD, getString(R.string.action_download_artwork)));
setUserCommands(commands);
}
开发者ID:tbouron,项目名称:WlpprforMuzei,代码行数:10,代码来源:WlpprArtSource.java
示例17: commandsListToString
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@TypeConverter
@NonNull
public static String commandsListToString(List<UserCommand> commands) {
JSONArray commandsSerialized = new JSONArray();
if (commands != null) {
for (UserCommand command : commands) {
commandsSerialized.put(command.serialize());
}
}
return commandsSerialized.toString();
}
开发者ID:romannurik,项目名称:muzei,代码行数:12,代码来源:UserCommandTypeConverter.java
示例18: onUpdate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
protected void onUpdate(@UpdateReason int reason) {
List<UserCommand> commands = new ArrayList<>();
if (reason == UPDATE_REASON_INITIAL) {
// Show initial photo (starry night)
publishArtwork(new Artwork.Builder()
.imageUri(Uri.parse("file:///android_asset/starrynight.jpg"))
.title("The Starry Night")
.token("initial")
.byline("Vincent van Gogh, 1889.\nMuzei shows a new painting every day.")
.attribution("wikiart.org")
.viewIntent(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.wikiart.org/en/vincent-van-gogh/the-starry-night-1889")))
.metaFont(MuzeiContract.Artwork.META_FONT_TYPE_ELEGANT)
.build());
commands.add(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK));
// show the latest photo in 15 minutes
scheduleUpdate(System.currentTimeMillis() + 15 * 60 * 1000);
} else {
// For everything but the initial update, defer to RemoteMuzeiArtSource
super.onUpdate(reason);
}
commands.add(new UserCommand(COMMAND_ID_SHARE, getString(R.string.featuredart_action_share_artwork)));
commands.add(new UserCommand(COMMAND_ID_VIEW_ARCHIVE,
getString(R.string.featuredart_source_action_view_archive)));
if (BuildConfig.DEBUG) {
commands.add(new UserCommand(COMMAND_ID_DEBUG_INFO, "Debug info"));
}
setUserCommands(commands);
}
开发者ID:romannurik,项目名称:muzei,代码行数:33,代码来源:FeaturedArtSource.java
示例19: getUserCommandAt
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
public UserCommand getUserCommandAt(int index) {
return mUserCommands.get(index);
}
开发者ID:tasomaniac,项目名称:MuzeiEarthView,代码行数:4,代码来源:SourceState.java
示例20: onCreate
import com.google.android.apps.muzei.api.UserCommand; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
setUserCommands(new UserCommand(BUILTIN_COMMAND_ID_NEXT_ARTWORK),
new UserCommand(COMMAND_SHARE_ARTWORK, getString(R.string.share)));
}
开发者ID:danybony,项目名称:MapsMuzei,代码行数:7,代码来源:MapsArtSource.java
注:本文中的com.google.android.apps.muzei.api.UserCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论