Java Code Examples for android.view.View.DragShadowBuilder

The following are Jave code examples for showing how to use DragShadowBuilder of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: SmingZZick_App   File: StickerApplyAdapter.java   Source Code and License Vote up 7 votes
@Override
public boolean onLongClick(View v) {
    ClipData.Item item = new ClipData.Item("" + v.getTag());
    ClipData dragData = new ClipData("" + v.getTag(), new String[] {ClipDescription.MIMETYPE_TEXT_PLAIN},item);

    View.DragShadowBuilder myShadow = new MyDragShadowBuilder(v);

    showDragBuide();
    v.startDrag(dragData,  // the data to be dragged
            myShadow,  // the drag shadow builder
            null,      // no need to use local data
            0          // flags (not currently used, set to 0)
    );
    v.setAlpha(0.2f);
    return true;
}
 
Example 2
Project: JavaIsFun   File: LacoDeRepeticao7.java   Source Code and License Vote up 6 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 3
Project: GitHub   File: DragSortAdapter.java   Source Code and License Vote up 5 votes
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public final void startDrag(View.DragShadowBuilder dragShadowBuilder) {
    Point shadowSize = new Point();
    Point shadowTouchPoint = new Point();
    dragShadowBuilder.onProvideShadowMetrics(shadowSize, shadowTouchPoint);

    itemView.startDrag(null, dragShadowBuilder,
            new DragInfo(getItemId(), shadowSize, shadowTouchPoint, adapter.getLastTouchPoint()), 0);

    adapter.notifyItemChanged(getAdapterPosition());
}
 
Example 4
Project: LaunchTime   File: MainActivity.java   Source Code and License Vote up 5 votes
public boolean startDrag() {

        if (mDragPotential==null) return false;

        AppLauncher dragitem = (AppLauncher) mDragPotential.getTag();
        String label = dragitem.getLabel();
        ClipData data = ClipData.newPlainText(label, label);
        View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(mDragPotential);

        boolean dragstarted;
        if (Build.VERSION.SDK_INT>=24) {
            dragstarted = mDragPotential.startDragAndDrop(data, shadowBuilder, mDragPotential, 0);
        } else {
            dragstarted = mDragPotential.startDrag(data, shadowBuilder, mDragPotential, 0);
        }

        if (dragstarted) {
            mBeingDragged = dragitem;
            mDragDropSource = (ViewGroup) mDragPotential.getParent();
            Log.d(TAG, "Drag started: " + dragitem.getActivityName() +  ", source = " + mDragDropSource);
            showHiddenCategories();

           // Log.d(TAG, "source = " + mDragDropSource);
            //if (mDragDropSource.getId()!=R.id.icontarget) {
                showRemoveDropzone();
            //}
            return true;
        }


        return false;
    }
 
Example 5
Project: egma-shapi   File: DragHelper.java   Source Code and License Vote up 5 votes
/**
 * Start a drag motion.
 *
 * @param source source
 * @param shadow shadow
 * @param data   data
 */
public void startDrag(View source, View.DragShadowBuilder shadow, Object data) {
    ClipData clipData = ClipData.newPlainText(data.getClass().getName(), "");
    DragData dragData = new DragData(source, data);
    int token = clipData.getDescription().hashCode();
    mDraggedItems.put(token, dragData);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        DragStarterPostNougatImpl.startDrag(source, clipData, shadow, token, 0);
    } else {
        DragStarterPreNougatImpl.startDrag(source, clipData, shadow, token, 0);
    }
}
 
Example 6
Project: JavaIsFun   File: Vetores9.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 7
Project: JavaIsFun   File: Vetores8.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 8
Project: JavaIsFun   File: Calculos8.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 9
Project: JavaIsFun   File: Calculos7.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 10
Project: JavaIsFun   File: Calculos6.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 11
Project: JavaIsFun   File: LacoDeRepeticao8.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 12
Project: JavaIsFun   File: Calculos9.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 13
Project: JavaIsFun   File: LacoDeRepeticao6.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 14
Project: JavaIsFun   File: LacoDeRepeticao9.java   Source Code and License Vote up 5 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);




    return (true);
}
 
Example 15
Project: GitHub   File: DragSortAdapter.java   Source Code and License Vote up 4 votes
public View.DragShadowBuilder getShadowBuilder(View itemView, Point touchPoint) {
    return new DragSortShadowBuilder(itemView, touchPoint);
}
 
Example 16
Project: GitHub   File: DragAdatper.java   Source Code and License Vote up 4 votes
@Override public View.DragShadowBuilder getShadowBuilder(View itemView, Point touchPoint) {
    return new NoForegroundShadowBuilder(itemView, touchPoint);
}
 
Example 17
Project: JavaIsFun   File: Matrizes6.java   Source Code and License Vote up 4 votes
@Override
public boolean onLongClick(View v) {
    ClipData data = ClipData.newPlainText("simple_text", "text");


    View.DragShadowBuilder sb = new View.DragShadowBuilder(v);

    v.startDrag(data, sb, v, 0);

    v.setVisibility(View.INVISIBLE);


    return (true);
}
 
Example 18
Project: egma-shapi   File: DragStarterPreNougatImpl.java   Source Code and License Vote up 3 votes
/**
 * Used to start a drag on the given view.
 *
 * @param source   view from which the drag motion is started.
 * @param clipData data linked to the drag motion.
 * @param shadow   shadow displayed during the drag.
 * @param token    token.
 * @param i        flags.
 */
public static void startDrag(View source, ClipData clipData, View.DragShadowBuilder shadow, int token, int i) {
    source.startDrag(clipData, shadow, token, i);
}
 
Example 19
Project: egma-shapi   File: DragStarterPostNougatImpl.java   Source Code and License Vote up 2 votes
/**
 * Used to start a drag on the given view.
 *
 * @param source   view from which the drag motion is started.
 * @param clipData data linked to the drag motion.
 * @param shadow   shadow displayed during the drag.
 * @param token    token.
 * @param i        flags.
 */
public static void startDrag(View source, ClipData clipData, View.DragShadowBuilder shadow, int token, int i) {
    source.startDragAndDrop(clipData, shadow, token, i);
}