use of com.facebook.fresco.samples.showcase.common.ToggleAnimationClickListener 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;
}
});
}
});
}
Aggregations