@Override public void onClick(View v) { ViewHolder holder = (ViewHolder) v.getTag(); // team.setMonsterOverwrite(holder.getAdapterPosition()); // team.save(); Singleton.getInstance().setMonsterOverwrite(holder.getAdapterPosition()); if (monsterList.get(holder.getAdapterPosition()).getMonsterId() == 0) { ((MainActivity) mContext) .switchFragment( MonsterTabLayoutFragment.newInstance(false, 0, holder.getAdapterPosition()), MonsterTabLayoutFragment.TAG, "good"); } else { Parcelable monsterParcel = Parcels.wrap(monsterList.get(holder.getAdapterPosition())); ((MainActivity) mContext) .switchFragment( MonsterPageFragment.newInstance( monsterList.get(holder.getAdapterPosition()).getMonsterId(), holder.getAdapterPosition(), monsterParcel), MonsterPageFragment.TAG, "good"); // ((MainActivity) // mContext).switchFragment(MonsterPageFragment.newInstance(realm.copyFromRealm(monsterList.get(holder.getAdapterPosition())), holder.getAdapterPosition()), MonsterPageFragment.TAG, "good"); } }
@Override public boolean onLongClick(View v) { ViewHolder holder = (ViewHolder) v.getTag(); Singleton.getInstance().setMonsterOverwrite(holder.getAdapterPosition()); // Intent i = new Intent(mContext, MonsterTabLayoutActivity.class); // Bundle bundle = new Bundle(); // bundle.putBoolean("replaceAll", false); // bundle.putLong("replaceMonsterId", // monsterList.get(holder.getAdapterPosition()).getMonsterId()); // bundle.putInt("monsterPosition", holder.getAdapterPosition()); // i.putExtras(bundle); // ((Activity)mContext).startActivityForResult(i, 1); ((MainActivity) mContext) .switchFragment( MonsterTabLayoutFragment.newInstance( false, monsterList.get(holder.getAdapterPosition()).getMonsterId(), holder.getAdapterPosition()), MonsterTabLayoutFragment.TAG, "good"); return true; }