use of com.facebook.drawee.view.SimpleDraweeView in project DevRing by LJYcoder.
the class FrescoManager method load.
private void load(Uri uri, ImageView imageView, LoadOption loadOption) {
Preconditions.checkNotNull(imageView, "加载图片的控件不能为空!");
if (imageView instanceof SimpleDraweeView) {
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) imageView;
setHierarchay(simpleDraweeView.getHierarchy(), loadOption);
ImageRequest imageRequest = getImageRequest(uri, simpleDraweeView, loadOption);
DraweeController draweeController = getController(imageRequest, simpleDraweeView.getController());
simpleDraweeView.setController(draweeController);
} else {
throw new IllegalArgumentException("Fresco加载图片的控件需为SimpleDraweeView");
}
}
use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.
the class ImageFormatWebpFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
final SimpleDraweeView draweeWebpStatic = view.findViewById(R.id.drawee_view_webp_static);
draweeWebpStatic.setImageURI(sampleUris().createWebpStaticUri());
final SimpleDraweeView draweeWebpTranslucent = view.findViewById(R.id.drawee_view_webp_translucent);
draweeWebpTranslucent.setImageURI(sampleUris().createWebpTranslucentUri());
final SwitchCompat switchBackground = view.findViewById(R.id.switch_background);
switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
draweeWebpTranslucent.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
}
});
final SimpleDraweeView draweeWebpAnimated = view.findViewById(R.id.drawee_view_webp_animated);
draweeWebpAnimated.setController(Fresco.newDraweeControllerBuilder().setAutoPlayAnimations(true).setOldController(draweeWebpAnimated.getController()).setUri(sampleUris().createWebpAnimatedUri()).build());
final TextView supportStatusTextView = view.findViewById(R.id.text_webp_support_status);
final StringBuilder sb = new StringBuilder();
sb.append("WebpSupportStatus.sIsSimpleWebpSupported = ").append(WebpSupportStatus.sIsSimpleWebpSupported).append('\n');
sb.append("WebpSupportStatus.sIsExtendedWebpSupported = ").append(WebpSupportStatus.sIsExtendedWebpSupported).append('\n');
sb.append("WebpSupportStatus.sIsWebpSupportRequired = ").append(WebpSupportStatus.sIsWebpSupportRequired).append('\n');
supportStatusTextView.setText(sb.toString());
}
use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.
the class ImagePipelineQualifiedResourceFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
simpleDraweeView.setImageURI(QUALIFIED_RESOURCE_URI);
}
use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.
the class DraweeRotationFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mUri = sampleUris().createSampleUri(ImageUriProvider.ImageSize.M);
mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
final SimpleRotationOptionsAdapter adapter = new SimpleRotationOptionsAdapter();
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
final SimpleRotationOptionsAdapter.Entry spinnerEntry = (SimpleRotationOptionsAdapter.Entry) adapter.getItem(position);
setRotationOptions(spinnerEntry.rotationOptions);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinner.setSelection(0);
}
use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.
the class ImageDetailsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawee_transition_detail);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.image);
simpleDraweeView.setImageURI(getIntent().getData());
ScalingUtils.ScaleType toScaleType = ScalingUtils.ScaleType.FOCUS_CROP;
PointF toFocusPoint = new PointF(0.5f, 0);
simpleDraweeView.getHierarchy().setActualImageScaleType(toScaleType);
simpleDraweeView.getHierarchy().setActualImageFocusPoint(toFocusPoint);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ScalingUtils.ScaleType fromScaleType = ScalingUtils.ScaleType.FOCUS_CROP;
PointF fromFocusPoint = DraweeTransitionFragment.FOCUS_POINT;
getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(fromScaleType, toScaleType, fromFocusPoint, toFocusPoint));
getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(toScaleType, fromScaleType, toFocusPoint, fromFocusPoint));
}
}
Aggregations