Search in sources :

Example 11 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project osm-contributor by jawg.

the class ImageAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    SimpleDraweeView image = new SimpleDraweeView(context);
    image.setImageURI(Uri.parse(photosUrl.get(position)));
    image.setLayoutParams(new ViewGroup.LayoutParams((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 110, context.getResources().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 110, context.getResources().getDisplayMetrics())));
    return image;
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) ViewGroup(android.view.ViewGroup)

Example 12 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.

the class DraweeMediaPickerFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    mImagePath = (TextView) view.findViewById(R.id.image_path);
    mSimpleDraweeView.setOnClickListener(new ToggleAnimationClickListener(mSimpleDraweeView));
    View actionOpenDocumentButton = view.findViewById(R.id.pick_action_open_document);
    actionOpenDocumentButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("image/*");
                startActivityForResult(intent, REQUEST_CODE_PICK_MEDIA);
            } else {
                Toast.makeText(getContext(), R.string.drawee_media_picker_action_open_document_not_supported, Toast.LENGTH_SHORT).show();
            }
        }
    });
    View actionGetContent = view.findViewById(R.id.pick_action_get_content);
    actionGetContent.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.setType("image/*");
            startActivityForResult(intent, REQUEST_CODE_PICK_MEDIA);
        }
    });
    View actionPickButton = view.findViewById(R.id.pick_action_pick);
    actionPickButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            StoragePermissionHelper.INSTANCE.withStoragePermission(getActivity(), new Function1<Unit, Unit>() {

                @Override
                public Unit invoke(Unit unit) {
                    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                    startActivityForResult(intent, REQUEST_CODE_PICK_MEDIA);
                    return null;
                }
            });
        }
    });
}
Also used : Function1(kotlin.jvm.functions.Function1) ToggleAnimationClickListener(com.facebook.fresco.samples.showcase.common.ToggleAnimationClickListener) Intent(android.content.Intent) Unit(kotlin.Unit) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View)

Example 13 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.

the class DraweeScaleTypeFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_drawee_scale_type, container, false);
    final ImageUriProvider imageUriProvider = sampleUris();
    final Uri uri1 = imageUriProvider.createSampleUri(ImageUriProvider.ImageSize.M, ImageUriProvider.Orientation.LANDSCAPE);
    final Uri uri2 = imageUriProvider.createSampleUri(ImageUriProvider.ImageSize.M, ImageUriProvider.Orientation.PORTRAIT);
    mDraweeTop1 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_1);
    mDraweeTop2 = (SimpleDraweeView) view.findViewById(R.id.drawee_view_top_2);
    mDraweeMain = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    mSpinner = (Spinner) view.findViewById(R.id.spinner);
    mDraweeTop1.setImageURI(uri1);
    mDraweeTop1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(uri1);
        }
    });
    mDraweeTop2.setImageURI(uri2);
    mDraweeTop2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeMainDraweeUri(uri2);
        }
    });
    changeMainDraweeUri(uri1);
    final SimpleScaleTypeAdapter adapter = SimpleScaleTypeAdapter.createForAllScaleTypes();
    mSpinner.setAdapter(adapter);
    mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            final SimpleScaleTypeAdapter.Entry spinnerEntry = (SimpleScaleTypeAdapter.Entry) adapter.getItem(position);
            changeMainDraweeScaleType(spinnerEntry.scaleType, spinnerEntry.focusPoint);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
    mSpinner.setSelection(0);
    return view;
}
Also used : SimpleScaleTypeAdapter(com.facebook.fresco.samples.showcase.common.SimpleScaleTypeAdapter) AdapterView(android.widget.AdapterView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) ImageUriProvider(com.facebook.fresco.samples.showcase.misc.ImageUriProvider) Uri(android.net.Uri) Nullable(androidx.annotation.Nullable)

Example 14 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.

the class DraweeSimpleFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    final Uri uri = sampleUris().createSampleUri(ImageUriProvider.ImageSize.M);
    final SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    simpleDraweeView.setImageURI(uri);
    view.findViewById(R.id.btn_random_uri).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            simpleDraweeView.setImageURI(sampleUris().createSampleUri());
        }
    });
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) Uri(android.net.Uri) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View)

Example 15 with SimpleDraweeView

use of com.facebook.drawee.view.SimpleDraweeView in project fresco by facebook.

the class RetainingDataSourceSupplierFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    final SimpleDraweeView simpleDraweeView = view.findViewById(R.id.drawee_view);
    final RetainingDataSourceSupplier<CloseableReference<CloseableImage>> retainingSupplier = new RetainingDataSourceSupplier<>();
    simpleDraweeView.setController(Fresco.newDraweeControllerBuilder().setDataSourceSupplier(retainingSupplier).setControllerListener(controllerListener).build());
    replaceImage(retainingSupplier);
    simpleDraweeView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            replaceImage(retainingSupplier);
        }
    });
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) CloseableReference(com.facebook.common.references.CloseableReference) RetainingDataSourceSupplier(com.facebook.datasource.RetainingDataSourceSupplier) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View)

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