@Override public void requestControllerDidReceiveResponseSafe(final RequestController aRequestController) { final List<Game> featuredGames = _gamesController.getGames(); if (featuredGames.size() > 0) { final ValueStore store = getScreenValues(); final Game game = featuredGames.get(0); store.putValue(Constant.FEATURED_GAME, game); store.putValue(Constant.FEATURED_GAME_NAME, game.getName()); store.putValue(Constant.FEATURED_GAME_PUBLISHER, game.getPublisherName()); store.putValue(Constant.FEATURED_GAME_IMAGE_URL, game.getImageUrl()); showControlIcon(R.drawable.sl_button_arrow); } }
@Override public void onClick(final View view) { final Game featuredGame = getScreenValues().getValue(Constant.FEATURED_GAME); if (featuredGame != null) { getTracker() .trackEvent( TrackerEvents.CAT_NAVI, TrackerEvents.NAVI_HEADER_GAME_FEATURED, featuredGame.getName(), 0); display(getFactory().createGameDetailScreenDescription(featuredGame)); } }
@Override public void onRefresh(final int flags) { final Button controlButton = (Button) findViewById(R.id.sl_control_button); final Game game = getGame(); ImageDownloader.downloadImage( game.getImageUrl(), getResources().getDrawable(R.drawable.sl_icon_games_loading), getImageView(), null); setTitle(game.getName()); setSubTitle(game.getPublisherName()); if (game.getPackageNames() != null) { if (PackageManager.isGameInstalled(this, game)) { controlButton.setText(getString(R.string.sl_launch)); controlButton.setOnClickListener( new OnClickListener() { @Override public void onClick(final View v) { getTracker() .trackEvent( TrackerEvents.CAT_NAVI, TrackerEvents.NAVI_HEADER_GAME_LAUNCH, game.getName(), 0); PackageManager.launchGame(GameDetailHeaderActivity.this, game); } }); } else { controlButton.setText(getString(R.string.sl_get)); controlButton.setOnClickListener( new OnClickListener() { @Override public void onClick(final View v) { getTracker() .trackEvent( TrackerEvents.CAT_NAVI, TrackerEvents.NAVI_HEADER_GAME_GET, game.getName(), 0); PackageManager.installGame(GameDetailHeaderActivity.this, game); } }); } controlButton.setVisibility(View.VISIBLE); } else { controlButton.setVisibility(View.GONE); } }