Battling

- singles works (teampreview , attackign and switching and mega evolving)
- doubles works but no targetting yet (TODO, not sure about team preview?)
- Fixed a problem in the request case when we switch

TODO :

- a better UI
- targetting system for doubles
- teampreview for doubles
- canceling support?


Because the old way was  not working when teams are switched around (ex :
The old way :
A B C
we switch c for a
Server sends CBA
We look if c exists, yes we put it in position 1
We have cbc
Etc for b but then we cant find A
So we get a 4 pokemon team cbca instead of 3.
If you have a cleaner way to fix this bug, please do ill merge :)
On 29 Dec 2014 15:10, "Nam Thai" <notifications@github.com> wrote:

> In app/src/main/java/com/pokemonshowdown/data/BattleMessage.java
> <https://github.com/NamTThai/PokemonShowdownAndroidClient/pull/60#discussion-diff-22312582>
> :
>
> > -                                                MyApplication.toId(pkm.getName()));
> > -                                        int iconId = battleFragment.getIconId("p1", battleFragment.getPlayer1Team().size() - 1);
> > -                                        if (battleFragment.getView() == null) {
> > -                                            viewData.addViewSetterOnHold(iconId, pkmIcon,
> > -                                                    BattleFieldData.ViewData.SetterType.IMAGEVIEW_SETIMAGERESOURCE);
> > -                                        } else {
> > -                                            ImageView icon = (ImageView) battleFragment.getView().findViewById(iconId);
> > -                                            if (icon != null) {
> > -                                                icon.setImageResource(pkmIcon);
> > -                                            }
> > -                                        }
> > -                                    }
> > -                                });
> > -                            } else {
> > -                                battleFragment.getPlayer1Team().set(i, pkm);
> > -                            }
>
> Is this necessary? Why do you need to reset player team every move.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/NamTThai/PokemonShowdownAndroidClient/pull/60/files#r22312582>
> .
>