Search in sources :

Example 51 with SimpleDraweeView

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");
    }
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 52 with 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());
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) CheckerBoardDrawable(com.facebook.fresco.samples.showcase.misc.CheckerBoardDrawable) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton) SwitchCompat(androidx.appcompat.widget.SwitchCompat)

Example 53 with SimpleDraweeView

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);
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView)

Example 54 with SimpleDraweeView

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);
}
Also used : Spinner(android.widget.Spinner) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 55 with SimpleDraweeView

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));
    }
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) ScalingUtils(com.facebook.drawee.drawable.ScalingUtils) PointF(android.graphics.PointF) ActionBar(androidx.appcompat.app.ActionBar)

Aggregations

SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)58 View (android.view.View)30 TextView (android.widget.TextView)20 Uri (android.net.Uri)8 DraweeController (com.facebook.drawee.interfaces.DraweeController)8 Intent (android.content.Intent)6 ImageView (android.widget.ImageView)5 RecyclerView (android.support.v7.widget.RecyclerView)4 Button (android.widget.Button)4 TintImageView (com.bilibili.magicasakura.widgets.TintImageView)4 RoundingParams (com.facebook.drawee.generic.RoundingParams)4 Animatable (android.graphics.drawable.Animatable)3 ViewGroup (android.view.ViewGroup)3 AdapterView (android.widget.AdapterView)3 CompoundButton (android.widget.CompoundButton)3 LinearLayout (android.widget.LinearLayout)3 SwitchCompat (androidx.appcompat.widget.SwitchCompat)3 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)3 ControllerListener (com.facebook.drawee.controller.ControllerListener)3 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)3