本文整理汇总了Java中com.yandex.metrica.YandexMetrica类的典型用法代码示例。如果您正苦于以下问题:Java YandexMetrica类的具体用法?Java YandexMetrica怎么用?Java YandexMetrica使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
YandexMetrica类属于com.yandex.metrica包,在下文中一共展示了YandexMetrica类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initNotTrackable
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
/**
* Init playable without tracks (i.e radio station)
*/
private void initNotTrackable() {
rvTracks.setVisibility(View.GONE);
btnMediaMore.setVisibility(View.GONE);
svDetails.setVisibility(View.VISIBLE);
svDetails.setEnabled(false);
svDetails.setIMovable(this);
tvDetailedDescription.setText(playableItem.getDescription().isEmpty() ? getString(R.string.empty_description) : playableItem.getDescription());
fbDetailsPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (GlobalUtils.isInternetConnected()) {
UniversalPlayer.getInstance().setMediaItem(playableItem, true);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ActivityPlayer.openWithIntent(getActivity());
}
});
} else {
Toast.makeText(getActivity(), getString(R.string.no_internet_access), Toast.LENGTH_SHORT).show();
}
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_PLAY_RADIO);
}
});
}
示例2: initSubscribeBtn
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
private void initSubscribeBtn() {
btnSubscribe.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (playableItem.isSubscribed) {
ProfileManager.getInstance().removeSubscribedMediaItem(playableItem);
btnSubscribe.setText(getString(R.string.subscribe));
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_UNSUBSCRIBE);
} else {
ProfileManager.getInstance().addSubscribedMediaItem(playableItem);
btnSubscribe.setText(getString(R.string.unsubscribe));
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_SUBSCRIBE);
}
}
});
}
示例3: getPlayClickListener
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
private View.OnClickListener getPlayClickListener(final int position) {
return new View.OnClickListener() {
@Override
public void onClick(View view) {
DownloadMaster.getInstance().cleanProgressInterfaces();
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_PLAY_EPISODE);
Track track = tracks.get(position);
if (iPlayableMediaItem instanceof Podcast) {
((Podcast) iPlayableMediaItem).selectTrack(track);
}
ProfileManager.getInstance().removeNewTrack(iPlayableMediaItem, track);
notifyItemChanged(position);
UniversalPlayer.getInstance().setMediaItem(iPlayableMediaItem, true);
ActivityPlayer.openWithIntent((Activity) mContext);
}
};
}
示例4: onCreate
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
public void onCreate() {
isLoaded = false;
applicationContext = getApplicationContext();
YandexMetrica.activate(getApplicationContext(), Config.YANDEX_METRICS_API_KEY);
YandexMetrica.enableActivityAutoTracking(this);
FacebookSdk.sdkInitialize(applicationContext);
LoginMaster.getInstance().init();
new Prefs.Builder()
.setContext(this)
.setMode(ContextWrapper.MODE_PRIVATE)
.setPrefsName(getPackageName())
.setUseDefaultSharedPreference(true).build();
super.onCreate();
}
示例5: onMenuItemClick
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
public boolean onMenuItemClick(MenuItem item) {
MediaItem mediaItem = UniversalPlayer.getInstance().getPlayingMediaItem();
if (item.getItemId() == R.id.action_favorites_player) {
if (mediaItem.isSubscribed) {
itemFavorites.setIcon(getResources().getDrawable(R.drawable.ic_heart_white_24dp));
ProfileManager.getInstance().removeSubscribedMediaItem(mediaItem);
Toast.makeText(this, getString(R.string.removed_from_favorites), Toast.LENGTH_SHORT).show();
YandexMetrica.reportEvent(Analytics.PLAYER_UNSUBSCRIBE);
} else {
itemFavorites.setIcon(getResources().getDrawable(R.drawable.ic_heart_black_24dp));
ProfileManager.getInstance().addSubscribedMediaItem(mediaItem);
Toast.makeText(this, getString(R.string.added_to_favorites), Toast.LENGTH_SHORT).show();
YandexMetrica.reportEvent(Analytics.PLAYER_SUBSCRIBE);
}
} else if (item.getItemId() == R.id.action_player_settings) {
openContextMenu(findViewById(R.id.action_player_settings), ContextMenuType.PLAYER_SETTINGS, null, null);
}
return false;
}
示例6: onContextItemSelected
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getTitle().equals(getString(R.string.select_stream_quality))) {
YandexMetrica.reportEvent(Analytics.PLAYER_STREAM_QUALITY);
ContextMenuHelper.selectRadioStreamQuality(this, fragmentPlayer, (RadioItem) currentMediaItem);
} else if (item.getTitle().equals("Show notes")) {
DialogFragmentTrackInfo dialogFragmentTrackInfo = new DialogFragmentTrackInfo();
dialogFragmentTrackInfo.setTrack(((Podcast) UniversalPlayer.getInstance().getPlayingMediaItem()).getSelectedTrack());
dialogFragmentTrackInfo.enableStream = false;
showDialogFragment(dialogFragmentTrackInfo);
} else if (item.getTitle().equals(getString(R.string.stream_info))) {
ContextMenuHelper.showStreamInfoDialog(this);
YandexMetrica.reportEvent(Analytics.PLAYER_STREAM_INFO);
}
return super.onContextItemSelected(item);
}
示例7: bindTitleViewHolder
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
private void bindTitleViewHolder(RecyclerView.ViewHolder holder, int position) {
MediaItemTitle currentItem = (MediaItemTitle) items.get(position);
ViewHolderMediaItemTitle holderMediaItemTitle = ((ViewHolderMediaItemTitle) holder);
holderMediaItemTitle.tvMediaCardTitle.setText(currentItem.getTitle());
if (currentItem.getSubTitle().isEmpty()) {
holderMediaItemTitle.tvMediaCardSubTitle.setVisibility(View.GONE);
RelativeLayout.LayoutParams llp = (RelativeLayout.LayoutParams) holderMediaItemTitle.tvMediaCardTitle.getLayoutParams();
// Left // Top // Right // Bottom
llp.setMargins(UIHelper.dpToPixels(15), UIHelper.dpToPixels(10), UIHelper.dpToPixels(15), UIHelper.dpToPixels(3));
holderMediaItemTitle.tvMediaCardTitle.setLayoutParams(llp);
} else {
holderMediaItemTitle.tvMediaCardSubTitle.setVisibility(View.VISIBLE);
holderMediaItemTitle.tvMediaCardSubTitle.setText(currentItem.getSubTitle());
}
if (!currentItem.showButton) {
holderMediaItemTitle.btnMediaTitleMore.setVisibility(View.GONE);
} else {
holderMediaItemTitle.btnMediaTitleMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
YandexMetrica.reportEvent(Analytics.FEATURED_BUTTON_MORE);
Toast.makeText(mContext, R.string.coming_soon, Toast.LENGTH_SHORT).show();
}
});
}
holder.itemView.setTag(currentItem);
}
示例8: getDownloadCancellListener
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
private View.OnClickListener getDownloadCancellListener(final RecyclerView.ViewHolder holder, final Track currentTrack) {
return new View.OnClickListener() {
@Override
public void onClick(View view) {
DownloadMaster.DownloadTask task = DownloadMaster.getInstance().getTaskByName(currentTrack.getTitle());
if (task != null) {
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_CANCELL_DOWNLOAD_EPISODE);
DownloadMaster.getInstance().cancelDownload(currentTrack.getTitle());
((ViewHolderTrack) holder).btnDownload.setVisibility(View.VISIBLE);
((ViewHolderTrack) holder).cvDownloadProgress.setVisibility(View.INVISIBLE);
}
}
};
}
示例9: getPlaylistOpenClickListener
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
public View.OnClickListener getPlaylistOpenClickListener() {
isOpen = false;
return new View.OnClickListener() {
@Override
public void onClick(View v) {
YandexMetrica.reportEvent(Analytics.PLAYLIST_TOGGLE);
if (isOpen) {
runCloseAnimation();
} else {
runOpenPlaylistAnimation();
}
isOpen = !isOpen;
}
};
}
示例10: setMediaItem
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
/**
* Checks if given type of media item is supported, if yes copies it and save instance in player.
*
* @param mediaItem
*/
public void setMediaItem(MediaItem mediaItem) {
if (isCurrentMediaItem(mediaItem)) {
return;
}
YandexMetrica.reportEvent(Analytics.PLAY_PREFIX + mediaItem.getName());
if (mediaItem instanceof RadioItem) {
this.mediaItem = new RadioItem((RadioItem) mediaItem);
} else if (mediaItem instanceof Podcast) {
this.mediaItem = new Podcast((Podcast) mediaItem);
} else {
throw new RuntimeException("Unsupported type of MediaItem");
}
}
示例11: onContextItemSelected
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
int id = item.getItemId();
if (currentContextMenuData != null && currentContextMenuData instanceof Podcast
&& item.getTitle().equals(getString(R.string.about_podcast))) {
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_ABOUT_PODCAST);
ContextMenuHelper.showAboutPodcastDialog((Podcast) currentContextMenuData, this);
} else if (currentContextMenuData != null && currentContextMenuData instanceof Podcast
&& item.getTitle().equals(getString(R.string.open_on_disk))) {
YandexMetrica.reportEvent(Analytics.MIDDLE_SCREEN_OPEN_ON_DISK);
ContextMenuHelper.showPodcastInFolder((MediaItem) currentContextMenuData, this);
} else if (currentContextMenuData != null && currentContextMenuData instanceof Podcast
&& item.getTitle().equals(getString(R.string.remove_all_episods))) {
YandexMetrica.reportEvent(Analytics.MIDDLE_REMOVE_ALL_EPISODES);
ContextMenuHelper.removeAllDonwloadedEpisods(this, (Podcast) currentContextMenuData, onContextItemSelected);
} else if (currentContextMenuData != null && currentContextMenuData instanceof MediaItem.MediaItemBucket
&& item.getTitle().equals(getString(R.string.delete))) {
YandexMetrica.reportEvent(Analytics.MIDDLE_REMOVE_EPISODE);
MediaItem mediaItem = ((MediaItem.MediaItemBucket) currentContextMenuData).mediaItem;
Track track = ((MediaItem.MediaItemBucket) currentContextMenuData).track;
ContextMenuHelper.removeDonwloadedTrack(this, track, mediaItem, onContextItemSelected);
} else if (id == R.id.itemLogout) {
LoginMaster.getInstance().logout();
getSlidingMenu().updateHeader(true);
if (onContextItemSelected != null) {
onContextItemSelected.operationFinished();
}
}
return super.onContextItemSelected(item);
}
示例12: onCreate
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (!BuildConfig.DEBUG) {
// AppMetrica SDK
YandexMetrica.activate(getApplicationContext(), AM_KEY);
YandexMetrica.enableActivityAutoTracking(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
YandexMetrica.enableActivityAutoTracking(this);
}
}
}
示例13: onCreate
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override public void onCreate() {
super.onCreate();
instance = this;
Timber.plant(new AndroidUtils.AndroidDebugTree());
// Initializing the AppMetrica SDK
YandexMetrica.activate(getApplicationContext(), "");
// Tracking user activity
YandexMetrica.enableActivityAutoTracking(this);
}
示例14: onResume
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
// resume metric
YandexMetrica.onResumeActivity(this);
}
示例15: onPause
import com.yandex.metrica.YandexMetrica; //导入依赖的package包/类
@Override
protected void onPause() {
super.onPause();
// pause metric
YandexMetrica.onPauseActivity(this);
}