pedrovgs / DraggablePanel

Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.
Apache License 2.0
2.99k stars 605 forks source link

Disable DraggableView drag in landscape mode. #60

Open sikandercb opened 9 years ago

sikandercb commented 9 years ago

hi, how can i draggable view en-ability false lansdscape mode .

pedrovgs commented 9 years ago

Landscape mode is not supported right now with ResizeTransformer. There is an issues requesting that feature.

sikandercb commented 9 years ago

thanks to reply sir can you please tell me how can i disable the dragging ...? mean setenable(false) or some thing like this. there should be function like this setDraggedToMinimizeEnabled(false)

0xcra5hs commented 9 years ago

Hi sikandercb, i did try disable draggable view with the solution: In draggable view, declare : private boolean isDisableDraggableView = false;

@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if(isDisableDraggableView) return false; // -> add to this if (!isEnabled()) { return false; } }

@Override public boolean onTouchEvent(MotionEvent ev) { if(isDisableDraggableView) return false; // -> add to this int actionMasked = MotionEventCompat.getActionMasked(ev); }

and use it: disable : draggableView.setIsDisableDraggableView(true); draggableView.setEnable(false);

and enable draggableView.setIsDisableDraggableView(false); draggableView.setEnable(true);

pedrovgs commented 9 years ago

Hi @DuongNTdev I see you already have a patch? Are you going to send a PR?

sikandercb commented 9 years ago

thanks i have already done this..:)

0xcra5hs commented 9 years ago

/*

import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.ViewCompat; import android.support.v4.widget.ViewDragHelper; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.RelativeLayout; import com.github.pedrovgs.transformer.Transformer; import com.github.pedrovgs.transformer.TransformerFactory; import com.nineoldandroids.view.ViewHelper;

/**

I can't commit to your git because i dont' have permission

ppamorim commented 9 years ago

@DuongNTdev Please remove your comment, do a fork and implement anythink that you want, then, open a pull request.

Johannes11833 commented 7 years ago

this works draggableView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mMediaController.dispatchTouchEvent(event); return true; }else{ return false; } } });