Java Code Examples for com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView#setImage()

The following examples show how to use com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView#setImage() . 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: ViewPagerFragment.java    From subsampling-scale-image-view with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(layout.view_pager_page, container, false);

    if (savedInstanceState != null) {
        if (asset == null && savedInstanceState.containsKey(BUNDLE_ASSET)) {
            asset = savedInstanceState.getString(BUNDLE_ASSET);
        }
    }
    if (asset != null) {
        SubsamplingScaleImageView imageView = rootView.findViewById(id.imageView);
        imageView.setImage(ImageSource.asset(asset));
    }

    return rootView;
}
 
Example 2
Source File: FourFragment.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    Log.e(TAG, "onCreateView: ");

    if (null != rootView) {
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (null != parent) {
            parent.removeView(rootView);
        }
    } else {
        rootView = inflater.inflate(R.layout.fragment_four, container, false);
        loadData();
    }
    final SubsamplingScaleImageView imageView = rootView.findViewById(R.id.image);
    imageView.setImage(ImageSource.resource(R.drawable.cat));

    rootView.findViewById(R.id.reload).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(a){
                imageView.setImage(ImageSource.resource(R.drawable.a5));
            }else {
                imageView.setImage(ImageSource.resource(R.drawable.cat));
            }
            a=!a;
        }
    });

    return rootView;
}
 
Example 3
Source File: ImageDisplayLargeFragment.java    From subsampling-scale-image-view with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(layout.imagedisplay_large_fragment, container, false);
    final ImageDisplayActivity activity = (ImageDisplayActivity)getActivity();
    if (activity != null) {
        rootView.findViewById(id.next).setOnClickListener(new View.OnClickListener() {
            @Override public void onClick(View v) { activity.next(); }
        });
    }
    SubsamplingScaleImageView imageView = rootView.findViewById(id.imageView);
    imageView.setImage(ImageSource.asset("card.png"));
    return rootView;
}
 
Example 4
Source File: ImagePreViewAdapter.java    From CrazyDaily with Apache License 2.0 4 votes vote down vote up
@Override
protected void convert(@NonNull BaseViewHolder holder, @NonNull ImagePreViewEntity data) {
    SubsamplingScaleImageView imageView = holder.getView(R.id.item_image_preview, SubsamplingScaleImageView.class);
    imageView.setMaxScale(data.maxScale);
    imageView.setImage(data.source, data.state);
}
 
Example 5
Source File: BasicFeaturesActivity.java    From subsampling-scale-image-view with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SubsamplingScaleImageView view = findViewById(id.imageView);
    view.setImage(ImageSource.asset("sanmartino.jpg"));
}