當前位置: 首頁>>代碼示例>>Java>>正文


Java Artwork.getToken方法代碼示例

本文整理匯總了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);
}
 
開發者ID:WangDaYeeeeee,項目名稱:Mysplash,代碼行數:18,代碼來源:MuzeiSourceService.java

示例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)));
}
 
開發者ID:tasomaniac,項目名稱:MuzeiEarthView,代碼行數:19,代碼來源:EarthViewArtSource.java

示例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);
}
 
開發者ID:tasomaniac,項目名稱:MuzeiEarthView,代碼行數:25,代碼來源:EarthViewArtSource.java

示例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;
	}
}
 
開發者ID:ming13,項目名稱:muzei-earth-view,代碼行數:10,代碼來源:WallpaperArtworkSource.java

示例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); 
}
 
開發者ID:xgouchet,項目名稱:MuzeiDeezerAlbums,代碼行數:46,代碼來源:ArtSourceService.java


注:本文中的com.google.android.apps.muzei.api.Artwork.getToken方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。