本文整理匯總了Java中com.google.android.apps.muzei.api.Artwork.getToken方法的典型用法代碼示例。如果您正苦於以下問題:Java Artwork.getToken方法的具體用法?Java Artwork.getToken怎麽用?Java Artwork.getToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.apps.muzei.api.Artwork
的用法示例。
在下文中一共展示了Artwork.getToken方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onTryUpdate
import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
protected void onTryUpdate(int reason) throws RetryException {
MuzeiOptionManager manager = MuzeiOptionManager.getInstance(this);
if (manager.isUpdateOnlyInWifi() && !isWifi()) {
return;
}
if (System.currentTimeMillis() - manager.getLastUpdateTime()
< manager.getUpdateInterval() * UNIT_UPDATE_INTERVAL
&& reason != UPDATE_REASON_USER_NEXT) {
return;
}
Artwork art = getCurrentArtwork();
String currentToken = art == null ? null : art.getToken();
update(manager, getRandomCollectionId(manager), currentToken);
}
示例2: shareArtwork
import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
private void shareArtwork() {
Artwork currentArtwork = getCurrentArtwork();
if (currentArtwork == null) {
displayToastOnMainThread(R.string.error_no_image_to_share);
return;
}
String detailUrl = "https://g.co/ev/" + currentArtwork.getToken();
String title = currentArtwork.getTitle().trim();
String text = getString(R.string.artwork_share_text, title, detailUrl);
Intent shareIntent = new Intent(Intent.ACTION_SEND)
.setType("text/plain")
.putExtra(Intent.EXTRA_TEXT, text)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(Intent.createChooser(shareIntent, getString(R.string.action_share_artwork)));
}
示例3: downloadArtwork
import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
private void downloadArtwork() {
Artwork currentArtwork = getCurrentArtwork();
if (currentArtwork == null) {
displayToastOnMainThread(R.string.error_no_image_to_download);
return;
}
String downloadUrl = earthViewPrefs.get().getDownloadUrl();
if (downloadUrl == null) {
return;
}
String fileName = currentArtwork.getToken() + ".jpg";
Uri downloadUri = Uri.parse(BASE_URL + downloadUrl);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(downloadUri)
.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, fileName)
.setMimeType(MIME_TYPE_IMAGE)
.setVisibleInDownloadsUi(true)
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.allowScanningByMediaScanner();
dm.enqueue(request);
}
示例4: getCurrentWallpaperId
import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
private String getCurrentWallpaperId() {
Artwork currentWallpaperArtwork = getCurrentArtwork();
if (currentWallpaperArtwork != null) {
return currentWallpaperArtwork.getToken();
} else {
return null;
}
}
示例5: onTryUpdate
import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
protected void onTryUpdate(final int reason)
throws RetryException {
Preferences.loadPreferences(this);
Artwork current = getCurrentArtwork();
String token = current == null ? "" : current.getToken();
try {
mCurrentAlbumId = Long.valueOf(token);
}
catch (NumberFormatException e) {
mCurrentAlbumId = 0L;
}
switch (Preferences.getSourceType()) {
case Preferences.SOURCE_EDITO:
Log.i("Source", "Edito");
publishEdito();
break;
case Preferences.SOURCE_FAVS:
if (Preferences.getUserId() == 0L) {
Log.i("Source", "No User, no Favs -> Edito");
publishEdito();
} else {
Log.i("Source", "User Favs");
publishUserAlbum();
}
break;
case Preferences.SOURCE_LAST_PLAYED:
Log.i("Source", "Playing");
publishLastPlayedTrack();
break;
case Preferences.SOURCE_CUSTOM:
Log.i("Source", "Custom List");
publishCustomAlbum();
break;
}
// schedule next update
long delay = 1000L * 60L * 60L * Preferences.getScheduleHourDelay();
scheduleUpdate(System.currentTimeMillis() + delay);
}