Java Code Examples for android.widget.ImageView#setOnDragListener()

The following examples show how to use android.widget.ImageView#setOnDragListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DropTargetFragment.java    From user-interface-samples with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_droptarget, container, false);
    final ImageView imageView = (ImageView) rootView.findViewById(R.id.image_target);

    ImageDragListener imageDragListener = new PermissionAwareImageDragListener();

    imageView.setOnDragListener(imageDragListener);

    // Restore the application state if an image was being displayed.
    if (savedInstanceState != null) {
        final String uriString = savedInstanceState.getString(IMAGE_URI);
        if (uriString != null) {
            mImageUri = Uri.parse(uriString);
            imageView.setImageURI(mImageUri);
        }
    }

    mReleasePermissionCheckBox = (CheckBox) rootView.findViewById(R.id.release_checkbox);

    return rootView;
}
 
Example 2
Source File: DropTargetFragment.java    From android-DragAndDropAcrossApps with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_droptarget, container, false);
    final ImageView imageView = (ImageView) rootView.findViewById(R.id.image_target);

    ImageDragListener imageDragListener = new PermissionAwareImageDragListener();

    imageView.setOnDragListener(imageDragListener);

    // Restore the application state if an image was being displayed.
    if (savedInstanceState != null) {
        final String uriString = savedInstanceState.getString(IMAGE_URI);
        if (uriString != null) {
            mImageUri = Uri.parse(uriString);
            imageView.setImageURI(mImageUri);
        }
    }

    mReleasePermissionCheckBox = (CheckBox) rootView.findViewById(R.id.release_checkbox);

    return rootView;
}
 
Example 3
Source File: FeedbackCollectionActivity.java    From ssj with GNU General Public License v3.0 6 votes vote down vote up
private void init()
{
	innerFeedbackCollectionContainerElement = feedbackCollectionContainerElement;
	feedbackCollectionContainerElement = null;
	if (innerFeedbackCollectionContainerElement == null)
	{
		finish();
		throw new RuntimeException("no feedbackcontainer given");
	}
	levelLinearLayout = (LinearLayout) findViewById(R.id.feedbackLinearLayout);
	recycleBin = (ImageView) findViewById(R.id.recycleBin);
	recycleBin.setOnDragListener(new FeedbackCollectionOnDragListener(this));

	setTitle(((FeedbackCollection) innerFeedbackCollectionContainerElement.getElement()).getComponentName());
	feedbackLevelLayoutList = new ArrayList<>();

	this.feedbackListener = new FeedbackListener()
	{
		@Override
		public void onComponentAdded()
		{
			deleteEmptyLevels();
			addEmptyLevel();
		}
	};
}
 
Example 4
Source File: BubbleView.java    From BubbleActions with Apache License 2.0 5 votes vote down vote up
public BubbleView(Context context) {
    super(context);

    setOrientation(VERTICAL);
    LayoutInflater.from(context).inflate(R.layout.bubble_actions_bubble_item, this, true);
    textView = (TextView) getChildAt(0);
    imageView = (ImageView) getChildAt(1);
    imageView.setOnDragListener(dragListener);
    imageView.setScaleX(DESELECTED_SCALE);
    imageView.setScaleY(DESELECTED_SCALE);
}
 
Example 5
Source File: EditFragment.java    From Passbook with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    if(mApp == null || mApp.getAccountManager() == null) {
        return null;
    }
    View rootView = inflater.inflate(R.layout.fragment_edit, container, false);
    mContainer = rootView.findViewById(android.R.id.list);
    View footer = inflater.inflate(R.layout.add_field, container, false);
    footer.setOnClickListener(this);
    mNameEditText = rootView.findViewById(android.R.id.title);
    mScroll = rootView.findViewById(R.id.scroll);
    mNameEditText.addTextChangedListener(this);
    mToolbarContainer = rootView.findViewById(R.id.toolbar_container);
    if(mToolbarContainer!=null) {
        mHeader = rootView.findViewById(R.id.header);
        mScroll.setPbScrollListener(this);
    }
    setupToolbar(rootView);
    mCategorySpinner = rootView.findViewById(R.id.category);
    if(mAccountId >= 0) {
        mDummyAccount = mApp.getAccountManager().getAccountById(mAccountId).clone();
        mName = mDummyAccount.getAccountName();
    }
    else {
        mDummyAccount = getEntryList();
        mName = "";
    }
    int spinnerLayout = android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.JELLY_BEAN ?
            android.R.layout.simple_spinner_dropdown_item : R.layout.spinner_dropdown;
    if (getActivity() != null) {
        mTypeAdapter = ArrayAdapter.createFromResource(getActivity(),
                R.array.field_types, android.R.layout.simple_spinner_dropdown_item);
        mTypeAdapter.setDropDownViewResource(spinnerLayout);
    }
    mEntries = new ArrayList<> ();
    mDeleteView = (ImageView)inflater.inflate(R.layout.delete_field, container, false);
    int pos = 0;
    for(Entry e : mDummyAccount.getEntryList()) {
        onAddField(e, pos++);
    }
    mContainer.addView(footer);
    mContainer.addView(mDeleteView);
    mDeleteView.setOnDragListener(mDragListener);
    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getActivity(),
            android.R.layout.simple_spinner_dropdown_item , mApp.getSortedCategoryNames());
    spinnerAdapter.setDropDownViewResource(spinnerLayout);
    mCategorySpinner.setAdapter(spinnerAdapter);
    mCategorySpinner.setOnItemSelectedListener(this);
    View top = rootView.findViewById(R.id.top_frame);
    if(top!=null) {
        top.setOnClickListener(this);
    }
    return rootView;
}