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;
}
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;
}
});
}
});
}
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;
}
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());
}
});
}
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);
}
});
}
Aggregations