I have a list, it captured moving finger, and you can delete an item by sliding your finger
if the image is not loaded in my container, with ImageView.setImage(), the container moves correctly.
However, if I loaded one image the container moves slowler.
Why is this happening?
Attach images below.
1.moves correctly
- not moves correctly
always moves the container from left to rigth
Why is it?
Thanks.
UPDATE 19/01/2014
i reduced bitmap to 150 kb and continue equal.
leave my code
objelementos.lnyDatosCliente.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, final MotionEvent event) {
final CCliente objcCCliente = lstLista.get(objelementos.posicion);
CAnimaciones objAnmanim = new CAnimaciones();
Display pantalla = afrmGstionClientes.getActivity().getWindowManager().getDefaultDisplay();
final int ancho = pantalla.getWidth();
switch ( event.getAction()) {
case MotionEvent.ACTION_DOWN:
fdYPrimeroPulsado = event.getRawY();
fdXPulsadoInicio = event.getRawX();
fdXUltimaPulsado = event.getRawX();
iTamanioLnyPulsado =0;
break;
case MotionEvent.ACTION_MOVE:
float fdXPulsado = event.getRawX();
float fdXMovimiento = fdXPulsado- fdXUltimaPulsado;
objelementos.lnyDatosCliente.setVisibility(4);
objelementos.lnyDatosClienteToMove.setVisibility(0);
objelementos.lnyDatosClienteToMove.setX(fdXMovimiento);
iTamanioLnyPulsado =1;
break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL:
float fdXPulsad = event.getRawX();
float xmov =fdXPulsad- fdXUltimaPulsado;
fdYUltimoPulsado = event.getRawY();
int difx = (int)fdXPulsad- (int)fdXPulsadoInicio;
if (difx>120){
ObjectAnimator animaciion = objAnmanim.CrearAnimacion(objelementos.lnyDatosClienteToMove, xmov, ancho+10, "x", 85);//(xFin-20, ancho+10, 200) ;
animaciion.start();
new Handler().postDelayed(new Runnable() {
public void run() {
float num = objcCCliente.getposicionXInicio();
AlertDialog.Builder builder = new AlertDialog.Builder(
getContext());
builder.setIcon(R.drawable.ic_launcher);
builder.setTitle("!AVISO!");
builder.setMessage("¿Estas seguro de eliminar el cliente?")
.setPositiveButton("Si", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
CustomAdapterListadoClientes.this.lstLista.remove(objelementos.posicion);
CustomAdapterListadoClientes.this.notifyDataSetChanged();
dialog.dismiss();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
vol(ancho-10, objelementos.lnyDatosCliente.getX(), objelementos.lnyDatosClienteToMove, 180, objelementos.lnyDatosCliente);
dialog.dismiss();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}, animaciion.getDuration());
}else{
if (iTamanioLnyPulsado==0){
float dify = fdYPrimeroPulsado -fdYUltimoPulsado;
if (dify<0){
dify*=-1;
}
if (dify<10){
float fddondeesta = objelementos.lnyDatosCliente.getY();
ObjectAnimator animaciion = objAnmanim.CrearAnimacion(objelementos.lnyDatosCliente, fddondeesta-1, fddondeesta, "x",50);
animaciion.start();
Cnavegar objNavegar = new Cnavegar();
AfrmHigthModificationCliente afrmModificacion = new AfrmHigthModificationCliente(true, objcCCliente,afrmGstionClientes);
objNavegar.RemplazarFragmento(R.id.rtlAltas, afrmModificacion, "AfrmHigthModificationCliente", afrmGstionClientes.getActivity().getSupportFragmentManager());
}
}else{
if (difx>0){
vol(xmov, objelementos.lnyDatosCliente.getX(), objelementos.lnyDatosClienteToMove, 180, objelementos.lnyDatosCliente);
}else{
vol(xmov, objelementos.lnyDatosCliente.getX(), objelementos.lnyDatosClienteToMove, 180, objelementos.lnyDatosCliente);
}
}
}
break;
}
return true;
}
});