android.widget.ImageView#setOnDragListener ( )源码实例Demo

下面列出了android.widget.ImageView#setOnDragListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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;
}
 
@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;
}
 
源代码3 项目: ssj   文件: FeedbackCollectionActivity.java
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();
		}
	};
}
 
源代码4 项目: BubbleActions   文件: BubbleView.java
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);
}
 
源代码5 项目: Passbook   文件: EditFragment.java
@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;
}