private void initView() { panel = (GameCenterfourthPanel) itemView; imageFetcher = new ImageFetcher(); panel.getMore_game().setOnFocusChangeListener(this); panel.getMore_game().setOnClickListener(this); panel.getMore_game().setOnKeyListener(this); }
public void setData(AdInfo info) { this.adInfo = info; imageFetcher.loadImage( info.getCornerMark(), panel.getMore_game_released(), R.drawable.translation); UIUtils.setOnline(panel.getGame_online(), info.getOnline()); GameAdapterTypeUtil.decideAdapter( info.getHandleType(), panel.getHandle_icon(), panel.getControl_icon()); imageFetcher.loadImage(info.getUrl(), panel.getMore_game_iv(), R.drawable.default_vertical); }
@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); } } }