Пример #1
0
 @Override
 public void onClick(View v) {
   // Umeng统计所有交互
   UmengUtils.setOnEvent(context, UmengUtils.GAMECENTER_INTERACTION);
   v.requestFocus();
   Intent intent;
   if (getPosition() == 3) {
     // Umeng统计"单项3"
     UmengUtils.setOnEvent(context, UmengUtils.GAMECENTER_SINGLE3);
   } else if (getPosition() == 5) {
     // Umeng统计"单项6"
     UmengUtils.setOnEvent(context, UmengUtils.GAMECENTER_SINGLE6);
   }
   if (adInfo != null) {
     if (adInfo.getVideoUrl() == null || adInfo.getVideoUrl().isEmpty()) {
       intent = new Intent(context, GameDetailActivity.class);
       intent.putExtra(Constant.GAMECENTER, 1);
       intent.putExtra("gameId", adInfo.getGameId());
       context.startActivity(intent);
     } else {
       intent = new Intent(context, PlayVideoActivity.class);
       intent.putExtra(Constant.GAMECENTER, 1);
       intent.putExtra("videoUrl", adInfo.getVideoUrl());
       intent.putExtra("isGameVideo", true);
       intent.putExtra("gameId", adInfo.getGameId());
       context.startActivity(intent);
     }
   }
 }
Пример #2
0
  @Override
  public void onFocusChange(View v, boolean hasFocus) {
    if (hasFocus) {

      if (v.isInTouchMode()) {
        v.performClick();
      }

      int[] location = new int[2];
      v.getLocationOnScreen(location);

      /*
       * if (location[0] - v.getWidth() < mRecyclerView.getLeft() ) {
       * mRecyclerView.smoothScrollBy(- 400, 0); }
       */

      if (location[0] + (v.getWidth() * 1.3) > mRecyclerView.getRight()) {
        mRecyclerView.smoothScrollBy(300, 0);
      }

      if (v.getId() == R.id.more_game) {
        panel.getMore_game_shadow().setImageResource(R.drawable.white_focus);
        panel.getMore_game_content().setScaleX(1.1f);
        panel.getMore_game_content().setScaleY(1.1f);
        panel.getMore_game().setNextFocusUpId(R.id.tab_gamecenter);
        panel.getMore_game().setNextFocusDownId(panel.getMore_game().getId());
        if (adInfo != null) {
          if (adInfo.getVideoUrl() != null && !adInfo.getVideoUrl().isEmpty()) {
            panel.getMore_game_video().setVisibility(View.VISIBLE);
          }
        }
      }
    } else {
      if (v.getId() == R.id.more_game) {
        panel.getMore_game_shadow().setImageResource(android.R.color.transparent);
        panel.getMore_game_content().setScaleX(1.0f);
        panel.getMore_game_content().setScaleY(1.0f);
        panel.getMore_game_video().setVisibility(View.INVISIBLE);
      }
    }
  }