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


Java Artwork.getByline方法代碼示例

本文整理匯總了Java中com.google.android.apps.muzei.api.Artwork.getByline方法的典型用法代碼示例。如果您正苦於以下問題:Java Artwork.getByline方法的具體用法?Java Artwork.getByline怎麽用?Java Artwork.getByline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.apps.muzei.api.Artwork的用法示例。


在下文中一共展示了Artwork.getByline方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shareArtwork

import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
public void shareArtwork(Artwork currentArtwork) {
    if (currentArtwork == null || currentArtwork.getViewIntent() == null || currentArtwork.getByline() == null) {
        Timber.w("No current artwork, can't share.");
        displayToast(resources.getString(R.string.error_no_map_to_share));
    } else {
        analytics.artShared(currentArtwork);

        String detailUrl = currentArtwork.getViewIntent().getDataString();
        String artist = currentArtwork.getByline().replaceFirst("\\.\\s*($|\\n).*", "").trim();

        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_TEXT, resources.getString(R.string.share_intent_extra_text, currentArtwork.getTitle().trim(), artist, detailUrl));
        shareIntent = Intent.createChooser(shareIntent, resources.getString(R.string.share_intent_title));
        shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        context.startActivity(shareIntent);
    }
}
 
開發者ID:mainthread-technology,項目名稱:grand-maps-for-muzei,代碼行數:21,代碼來源:GrandMapsArtSourceService.java

示例2: onCustomCommand

import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
public void onCustomCommand(int id) {
    super.onCustomCommand(id);
    if (id == COMMAND_ID_SHARE) {
        Artwork currentArtwork = getCurrentArtwork();
        Intent shareWall = new Intent(Intent.ACTION_SEND);
        shareWall.setType("text/plain");
        String wallName = currentArtwork.getTitle();
        String authorName = currentArtwork.getByline();
        String storeUrl = MARKET_URL + getPackageName();
        String iconPackName = getString(R.string.app_name);
        shareWall.putExtra(Intent.EXTRA_TEXT,
                getString(R.string.share_text, wallName, authorName, iconPackName, storeUrl));
        shareWall = Intent.createChooser(shareWall, getString(R.string.share_title));
        shareWall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(shareWall);
    }
}
 
開發者ID:PitchedApps,項目名稱:Material-Glass,代碼行數:19,代碼來源:MuzeiArtSourceService.java

示例3: onCustomCommand

import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
protected void onCustomCommand(int id) {
    super.onCustomCommand(id);
    if (CUSTOM_COMMAND_ID_SHARE == id) {
        Artwork currentArtwork = getCurrentArtwork();
        if (currentArtwork == null) {
            Log.w(TAG, "No current artwork, can't share.");
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(GoProPotdArtSource.this,
                            R.string.goprophoto_source_error_no_photo_to_share,
                            Toast.LENGTH_SHORT).show();
                }
            });
            return;
        }

        String detailUrl = currentArtwork.getViewIntent().getDataString();
        String artist = currentArtwork.getByline();

        Intent shareIntent = new Intent(Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_TEXT, "My Android wallpaper today is '"
                + currentArtwork.getTitle().trim()
                + "' " + artist
                + ". #MuzeiGoPro\n\n"
                + detailUrl);
        shareIntent = Intent.createChooser(shareIntent, "Share photo");
        shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(shareIntent);

    }
}
 
開發者ID:kahluagenie,項目名稱:muzei-gopro,代碼行數:35,代碼來源:GoProPotdArtSource.java

示例4: onCustomCommand

import com.google.android.apps.muzei.api.Artwork; //導入方法依賴的package包/類
@Override
public void onCustomCommand(int id) {
	super.onCustomCommand(id);

	if (id == COMMAND_ID_SHARE) {
		Artwork currentArtwork = getCurrentArtwork();
		Intent shareIntent = new Intent(Intent.ACTION_SEND);
		shareIntent.setType("text/plain");

		Uri artUrl = currentArtwork.getImageUri();
		if(DEBUG)Log.d(TAG,"artUrl: " + artUrl);

		String author = currentArtwork.getByline();
		if(DEBUG)Log.d(TAG,"author: " + author);

		String playUrl = "http://play.google.com/store/apps/details?id=" + getPackageName();
		if(DEBUG)Log.d(TAG,"playUrl: " + playUrl);

		shareIntent.putExtra(Intent.EXTRA_TEXT,
				"My wallpaper today is " + currentArtwork.getTitle() + " by " + author + " \n"
						+ artUrl + " \n"
						+ "from the " + getString(R.string.app_name) + " app\n"
						+ "Get it now on the PlayStore! " + playUrl
				);

		shareIntent = Intent.createChooser(shareIntent, "Share Wallpaper");
		shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		startActivity(shareIntent);
	}
}
 
開發者ID:R3CONN3R,項目名稱:MuzeiWallpaper,代碼行數:31,代碼來源:WallSource.java


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