@Override protected void convert(BaseViewHolder viewHolder, final Wares wares) { SimpleDraweeView draweeView = (SimpleDraweeView) viewHolder.getView(R.id.drawee_view); draweeView.setImageURI(Uri.parse(wares.getImgUrl())); viewHolder.getTextView(R.id.text_title).setText(wares.getName()); viewHolder.getTextView(R.id.text_price).setText("¥ "+wares.getPrice()); Button button =viewHolder.getButton(R.id.btn_add); if(button !=null) { button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { provider.put(wares); ToastUtils.show(context, "已添加到购物车"); } }); } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); ImageDecodeOptions imageDecodeOptionsWithCustomDecoder = new ImageDecodeOptionsBuilder() .setCustomImageDecoder(CUSTOM_COLOR_DECODER) .build(); AbstractDraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest( ImageRequestBuilder.newBuilderWithResourceId(R.raw.custom_color1) .setImageDecodeOptions(imageDecodeOptionsWithCustomDecoder) .build()) .build(); simpleDraweeView.setController(controller); }
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) private void initAnimation(View view) { mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); DraweeController controller = Fresco.newDraweeControllerBuilder() .setOldController(mSimpleDraweeView.getController()) .setUri(URI_KEYFRAMES_ANIMATION) .setAutoPlayAnimations(true) .build(); mSimpleDraweeView.setController(controller); final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background); switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null); } }); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); draweeView.setActualImageResource(R.drawable.logo); draweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final RotateAnimation rotateAnimation = new RotateAnimation( 0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setDuration(1000); rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); draweeView.startAnimation(rotateAnimation); } }); final Button buttonGitHub = (Button) view.findViewById(R.id.button_github); setUriIntent(buttonGitHub, URL_GITHUB); final Button buttonDocumentation = (Button) view.findViewById(R.id.button_documentation); setUriIntent(buttonDocumentation, URL_DOCUMENTATION); }
private void loadThumb( SimpleDraweeView draweeView, Size size, ImageRequest.RequestLevel requestLevel) { ImageRequest request = ImageRequestBuilder.newBuilderWithSource(size.uri) .setMediaVariations(MediaVariations.newBuilderForMediaId(MEDIA_ID) .setForceRequestForSpecifiedUri(true) .build()) .setLowestPermittedRequestLevel(requestLevel) .setResizeOptions(new ResizeOptions(draweeView.getWidth(), draweeView.getHeight())) .setCacheChoice(size.cacheChoice) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(draweeView.getController()) .build(); draweeView.setController(controller); }
private void changeDraweeViewScaleType( SimpleDraweeView draweeView, ScaleType scaleType, @Nullable PointF focusPoint) { final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy(); hierarchy.setActualImageScaleType(scaleType); hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f)); final RoundingParams roundingParams = Preconditions.checkNotNull(hierarchy.getRoundingParams()); if (BITMAP_ONLY_SCALETYPES.contains(scaleType)) { roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY); } else { roundingParams.setOverlayColor(mWindowBackgroundColor); } hierarchy.setRoundingParams(roundingParams); }
@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()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet( ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER)); getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet( ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP)); } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { final ImageUriProvider imageUriProvider = ImageUriProvider.getInstance(getContext()); final Uri imageUri = imageUriProvider.createSampleUri(ImageUriProvider.ImageSize.M); final SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view); // You have to enable legacy visibility handling for the start view in order for this to work simpleDraweeView.setLegacyVisibilityHandlingEnabled(true); simpleDraweeView.setImageURI(imageUri); simpleDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startTransition(v, imageUri); } }); }
/** * 准备UI */ private void prepareUI() { mNavigationViewRed = (NavigationViewPush) findViewById(R.id.nav_user_info); mPortraitImageView = (SimpleDraweeView) findViewById(R.id.sdv_user_info_portrait); mUsernameTextView = (TextView) findViewById(R.id.tv_user_info_username); mGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_groupname); mPointsTextView = (TextView) findViewById(R.id.tv_user_info_points); mModifyInfoLayout = findViewById(R.id.rl_user_info_modify_info_layout); mModifySafeInfoLayout = findViewById(R.id.rl_user_info_modify_safe_info_layout); mRegisterTimeTextView = (TextView) findViewById(R.id.tv_user_info_registertime); mMyPointsTextView = (TextView) findViewById(R.id.tv_user_info_mypoints); mMyGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_mygroupname); mLogoutButton = (Button) findViewById(R.id.btn_user_info_logout); mNavigationViewRed.setupNavigationView(true, false, "我的资料", new NavigationViewPush.OnClickListener() { @Override public void onBackClick(View v) { finish(); } }); mModifyInfoLayout.setOnClickListener(this); mModifySafeInfoLayout.setOnClickListener(this); mLogoutButton.setOnClickListener(this); }
private void fillUserProfileData() { SimpleDraweeView imageView = (SimpleDraweeView) navigationView.getHeaderView(0).findViewById(R.id.imageView); TextView txtUserProfileName = (TextView) navigationView.getHeaderView(0).findViewById(R.id.txtUserProfileName); TextView txtProfileEmail = (TextView) navigationView.getHeaderView(0).findViewById(R.id.txtProfileEmail); // Check if user is signed in (non-null) and update UI accordingly. FirebaseUser currentUser = mAuth.getCurrentUser(); // Name, email address, and profile photo Url txtUserProfileName.setText(currentUser.getDisplayName()); txtProfileEmail.setText(currentUser.getEmail()); Uri photoUrl = currentUser.getPhotoUrl(); //set round icon if (photoUrl != null) { int color = ContextCompat.getColor(this, R.color.colorPrimary); RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f); roundingParams.setBorder(color, 1.0f); roundingParams.setRoundAsCircle(true); imageView.getHierarchy().setRoundingParams(roundingParams); imageView.setImageURI(photoUrl);//.setImageBitmap(stationImageSmall); } }
@Override public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getLayoutInflater().inflate(R.layout.swipe_card, parent, false); } SimpleDraweeView imageView = (SimpleDraweeView) convertView.findViewById(R.id.community_group_image); TextView textViewCard = (TextView) convertView.findViewById(R.id.textViewCard); TextView members_in_group = (TextView) convertView.findViewById(R.id.members_in_group); TextView group_tags_01 = (TextView) convertView.findViewById(R.id.group_tags_01); TextView group_tags_02 = (TextView) convertView.findViewById(R.id.group_tags_02); TextView group_tags_03 = (TextView) convertView.findViewById(R.id.group_tags_03); TextView group_details = (TextView) convertView.findViewById(R.id.group_details); group_tags_01.setText(mData.get(position).getCategoryName()); group_details.setText(mData.get(position).getGroup_description()); textViewCard.setText(mData.get(position).getGroupName()); members_in_group.setText(String.valueOf(mData.get(position).getGroup_members_joined() + " " + "members" + " " + mData.get(position).getGroup_posts_inside() + " " + "posts")); imageView.setImageURI(mData.get(position).getGroup_image_url()); imageView.setBackground(getResources().getDrawable(R.drawable.gradient_bg)); return convertView; }
/** * 指定控件 * * @param simpleDraweeView */ public void into(@NonNull SimpleDraweeView simpleDraweeView) { ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri); if (resizeOptions != null) { imageRequestBuilder.setResizeOptions(resizeOptions); } if (postprocessor != null) { imageRequestBuilder.setPostprocessor(postprocessor); } if (priority != null) { imageRequestBuilder.setRequestPriority(priority); } DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequestBuilder.build()) .setOldController(simpleDraweeView.getController()) .build(); simpleDraweeView.setController(controller); }
private void load(ImageView target, Uri uri, Options options) { if (target == null) { throw new NullPointerException("this imageView is null."); } if (options == null) options = Options.defaultOptions(); if (target instanceof SimpleDraweeView) { ViseLog.i("Fresco Load SimpleDraweeView Path:" + uri.getPath()); SimpleDraweeView simpleDraweeView = (SimpleDraweeView) target; simpleDraweeView.setImageURI(uri); if (options.loadingResId != Options.RES_NONE) { simpleDraweeView.getHierarchy().setPlaceholderImage(options.loadingResId); } if (options.loadErrorResId != Options.RES_NONE) { simpleDraweeView.getHierarchy().setFailureImage(options.loadErrorResId); } } else { ViseLog.e("Fresco Load ImageView must be SimpleDraweeView"); } }
private void layoutChildrenView() { int childrenCount = getChildCount(); for (int i = 0; i < childrenCount; i++) { ViewGroup childImageLayout = (ViewGroup) getChildAt(i); SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0); if (mOnItemClickListener != null) { final int finalI = i; childImageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.OnItemClick(finalI); } }); } ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i))) .setProgressiveRenderingEnabled(true) .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth)) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(childImageView.getController()) .build(); childImageView.setController(controller); int[] position = findPosition(i); int itemHeight = mItemWidth; int left = (int) (mItemWidth + mHorizontalSpace) * position[1]; int top = (int) (itemHeight + mVerticalSpace) * position[0]; int right = left + mItemWidth; int bottom = top + itemHeight; childImageLayout.layout(left, top, right, bottom); } }
private void refreshImageChild() { int childrenCount = getChildCount(); if (childrenCount > 0) { for (int i = 0; i < childrenCount; i++) { ViewGroup childImageLayout = (ViewGroup) getChildAt(i); SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0); if (mOnItemClickListener != null) { final int finalI = i; childImageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.OnItemClick(finalI); } }); } ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i))) .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth)) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(childImageView.getController()) .build(); childImageView.setController(controller); } } }
private void showStructImg(Context context, StructModel structModel, View structImgView, SimpleDraweeView structImg) { try { final String imgUrl = structModel.getImg_url(); if (!TextUtils.isEmpty(imgUrl)) { structImgView.setVisibility(View.VISIBLE); UdeskUtil.loadImageView(context, structImg, Uri.parse(imgUrl)); structImgView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { UdeskUtil.previewPhoto(mContext, Uri.parse(imgUrl)); } }); } else { structImgView.setVisibility(View.GONE); } } catch (Exception e) { e.printStackTrace(); } catch (OutOfMemoryError error) { error.printStackTrace(); } }
public void display(SimpleDraweeView view, String url, Postprocessor postprocessor) { if (!TextUtils.isEmpty(url)) { Uri uri; if (URLUtil.isNetworkUrl(url)) { uri = Uri.parse(url); } else { uri = Uri.fromFile(new File(url)); } ImageRequest request = ImageRequestBuilder .newBuilderWithSource(uri) .setPostprocessor(postprocessor) .setProgressiveRenderingEnabled(true) //.setResizeOptions(new ResizeOptions(100, 100)) .setLocalThumbnailPreviewsEnabled(true) .setRotationOptions(RotationOptions.autoRotateAtRenderTime()) .build(); controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(view.getController()) .build(); view.setController(controller); } }
public static void loadHeadView(Context context, SimpleDraweeView simpleDraweeView, Uri httpUri) { //初始化圆角圆形参数对象 RoundingParams rp = new RoundingParams(); //设置图像是否为圆形 rp.setRoundAsCircle(true); final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(context.getResources()) .setRoundingParams(rp) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(httpUri) .setTapToRetryEnabled(true) .setOldController(simpleDraweeView.getController()) .build(); simpleDraweeView.setHierarchy(hierarchy); simpleDraweeView.setController(controller); }
@Override public boolean onDependentViewChanged(CoordinatorLayout parent, SimpleDraweeView child, View dependency) { maybeInitProperties(child, dependency); final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight()); float expandedPercentageFactor = dependency.getY() / maxScrollDistance; float distanceYToSubtract = ((mStartYPosition - mFinalYPosition) * (1f - expandedPercentageFactor)) + (child.getHeight()/2); float distanceXToSubtract = ((mStartXPosition - mFinalXPosition) * (1f - expandedPercentageFactor)) + (child.getWidth()/2); float heightToSubtract = ((mStartHeight - finalHeight) * (1f - expandedPercentageFactor)); child.setY(mStartYPosition - distanceYToSubtract); child.setX(mStartXPosition - distanceXToSubtract); int proportionalAvatarSize = (int) (mAvatarMaxSize * (expandedPercentageFactor)); CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams(); lp.width = (int) (mStartHeight - heightToSubtract); lp.height = (int) (mStartHeight - heightToSubtract); child.setLayoutParams(lp); return true; }
@SuppressLint("PrivateResource") private void maybeInitProperties(SimpleDraweeView child, View dependency) { if (mStartYPosition == 0) mStartYPosition = (int) (dependency.getY()); if (mFinalYPosition == 0) mFinalYPosition = (dependency.getHeight() /2); if (mStartHeight == 0) mStartHeight = child.getHeight(); if (finalHeight == 0) finalHeight = mContext.getResources().getDimensionPixelOffset(R.dimen.image_small_width); if (mStartXPosition == 0) mStartXPosition = (int) (child.getX() + (child.getWidth() / 2)); if (mFinalXPosition == 0) mFinalXPosition = mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + (finalHeight / 2); if (mStartToolbarPosition == 0) mStartToolbarPosition = dependency.getY() + (dependency.getHeight()/2); }
@Override public void initViews() { post_recycler = (RecyclerView) findViewById(R.id.post_recycler); text_quit = (TextView) findViewById(R.id.text_quit); text_save = (TextView) findViewById(R.id.text_save); text_send = (TextView) findViewById(R.id.text_send); headView = LayoutInflater.from(this).inflate(R.layout.beegree_post_head_view, null); footView = LayoutInflater.from(this).inflate(R.layout.beegree_post_foot_view, null); image_cover_button = (ImageView) headView.findViewById(R.id.image_cover_button); edit_title = (EditText) headView.findViewById(R.id.edit_title); edit_title_place = (EditText) headView.findViewById(R.id.edit_title_place); post_header = (RelativeLayout) headView.findViewById(R.id.post_header); image_cover = (SimpleDraweeView) headView.findViewById(R.id.image_cover); image_set_cover = (ImageView) headView.findViewById(R.id.image_set_cover); image_delete_cover = (ImageView) headView.findViewById(R.id.image_delete_cover); adapter = new MyAdapter(PostActivity.this, this); linearLayoutManager = new LinearLayoutManager(this); edit_title.setOnClickListener(this); edit_title_place.setOnClickListener(this); }
public ViewHolder(View itemView) { super(itemView); if (itemView == mHeaderView) return; post_relative = (RelativeLayout) itemView.findViewById(R.id.post_relative); post_relative_image = (RelativeLayout) itemView.findViewById(R.id.post_relative_image); post_image = (SimpleDraweeView) itemView.findViewById(R.id.post_image); video_icon = (ImageView) itemView.findViewById(R.id.video_icon); image_one = (ImageView) itemView.findViewById(R.id.post_image_one); image_two = (ImageView) itemView.findViewById(R.id.post_image_two); image_three = (ImageView) itemView.findViewById(R.id.post_image_three); delete_image = (ImageView) itemView.findViewById(R.id.delete_image); delete_text_image = (ImageView) itemView.findViewById(R.id.delete_text_image); post_minus_image = (ImageView) itemView.findViewById(R.id.post_minus_image); post_add = (ImageView) itemView.findViewById(R.id.post_add); post_linear = (LinearLayout) itemView.findViewById(R.id.post_linear); post_linear_select = (LinearLayout) itemView.findViewById(R.id.post_linear_select); annotation_edit = (EditText) itemView.findViewById(R.id.annotation_edit); post_edittext = (EditText) itemView.findViewById(R.id.post_edittext); add_annotation = (TextView) itemView.findViewById(R.id.add_annotation); point_relative = (RelativeLayout) itemView.findViewById(R.id.point_relative); post_point_text = (TextView) itemView.findViewById(R.id.post_point_text); }
public static void setImageSmall(String url, SimpleDraweeView simpleDraweeView, int width, int height, SquareRelativeLayout relativeLayout, boolean playGif) { Uri uri = Uri.parse(url); ImageRequest request = ImageRequestBuilder .newBuilderWithSource(uri) .setRotationOptions(RotationOptions.autoRotate()) .setResizeOptions(new ResizeOptions(width, height)) .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setTapToRetryEnabled(true) .setImageRequest(request) .setAutoPlayAnimations(playGif) .setOldController(simpleDraweeView.getController()) .build(); relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(width - 5, height)); simpleDraweeView.setController(controller); }
private void setTrailContent() { List<TrailItem> trails = postsItem.getTrail(); if (trails != null && trails.size() > 0) { trailLayout.removeAllViews(); createTrailView(trails.size()); for (int i = 0; i < trails.size(); i++) { RelativeLayout layout = trailViewCache.get(i); SimpleDraweeView avatar = (SimpleDraweeView) layout.findViewById(R.id.trail_avatar); TextView name = (TextView) layout.findViewById(R.id.trail_name); TextView content = (TextView) layout.findViewById(R.id.trail_content); FrescoUtils.setTumblrAvatarUri(avatar, trails.get(i).getBlog().getName(), 128); name.setText(trails.get(i).getBlog().getName()); content.setText(fromHtlmCompat(trails.get(i).getContent_raw())); layout.setTag(trails.get(i).getBlog().getName()); trailLayout.addView(layout); } trailLayout.setVisibility(View.VISIBLE); } else { trailLayout.setVisibility(View.GONE); } }
private SimpleDraweeView createSimpleDraweeView() { SimpleDraweeView view = new SimpleDraweeView(itemView.getContext()); GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(itemView.getContext().getResources()); GenericDraweeHierarchy hierarchy = builder .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP) .setPlaceholderImage(R.color.loading_color) .setPlaceholderImageScaleType(ScalingUtils.ScaleType.FIT_CENTER) .setFailureImage(R.mipmap.ic_failed) .setFailureImageScaleType(ScalingUtils.ScaleType.CENTER) .build(); view.setHierarchy(hierarchy); view.setTag(atomicInteger.getAndIncrement()); view.setOnClickListener(this); return view; }
private void setupUI(){ imageView = (SimpleDraweeView) findViewById(R.id.image); tvCapital = (TextView) findViewById(R.id.capital); tvContinent = (TextView) findViewById(R.id.continent); tvCode = (TextView) findViewById(R.id.code); tvArea = (TextView) findViewById(R.id.area); tvPopulation = (TextView) findViewById(R.id.population); tvNorth = (TextView) findViewById(R.id.north); tvSouth = (TextView) findViewById(R.id.south); tvWest = (TextView) findViewById(R.id.west); tvEast = (TextView) findViewById(R.id.east); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } }
public CollectionAdapterViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); itemView.setClickable(true); mListItemLayout = itemView; mStationImageView = (SimpleDraweeView) itemView.findViewById(R.id.list_item_station_icon); mStationNameView = (TextView) itemView.findViewById(R.id.list_item_textview); mLayoutCategoryView = (LinearLayout) itemView.findViewById(R.id.layoutFavorit); mTxtCategoryView = (TextView) itemView.findViewById(R.id.txtFavorit); mRatingBarView = (RatingBar) itemView.findViewById(R.id.ratingBar); mFavoritButton = (ImageButton) itemView.findViewById(R.id.player_item_favorit_button); mStationDesciptionView = (TextView) itemView.findViewById(R.id.list_item_description); mPlaybackIndicator = (ImageView) itemView.findViewById(R.id.list_item_playback_indicator); mStationMenuView = (ImageView) itemView.findViewById(R.id.list_item_more_button); mFabPlayButton = (FloatingActionButton) itemView.findViewById(R.id.fabPlayButton); }
private void frescoViewSetScaleType(Context context, SimpleDraweeView mFrescoView){ GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(context.getResources()); GenericDraweeHierarchy hierarchy = builder.build(); mFrescoView.setHierarchy(hierarchy); switch (mScaleType) { case FIT_XY: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY); break; case FIT_START: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_START); break; case FIT_CENTER: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); break; case FIT_END: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_END); break; case CENTER: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER); break; case CENTER_CROP: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP); break; case CENTER_INSIDE: hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE); break; } }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.squareitem, null); } SimpleDraweeView image = (SimpleDraweeView) convertView.findViewById(R.id.icon); TextView text = (TextView) convertView.findViewById(R.id.text); TextView members_in_group = (TextView) convertView.findViewById(R.id.members_in_group); image.setImageURI(dataSet.get(position).getGroup_image_url()); text.setText(dataSet.get(position).getCategoryName()); members_in_group.setText(dataSet.get(position).getGroup_members_joined() + " members"); return convertView; }
public ViewHolder(View itemView) { super(itemView); draweeView = (SimpleDraweeView) itemView.findViewById(R.id.drawee_view); textTitle= (TextView) itemView.findViewById(R.id.text_title); textPrice= (TextView) itemView.findViewById(R.id.text_price); }
@Override protected void convert(BaseViewHolder viewHoder, Category item) { viewHoder.getTextView(R.id.text_title).setText(item.getName()); SimpleDraweeView draweeView = (SimpleDraweeView) viewHoder.getView(R.id.drawee_view); draweeView.setImageURI(Uri.parse(Contants.API.BASE_URL+item.getWrap_ptlist_threeImage())); }
/** Initializes Drawee with the specified config. */ private static void initializeDrawee( Context context, @Nullable DraweeConfig draweeConfig) { sDraweeControllerBuilderSupplier = new PipelineDraweeControllerBuilderSupplier(context, draweeConfig); SimpleDraweeView.initialize(sDraweeControllerBuilderSupplier); }
/** * 初始化界面 */ private void initView() { rvMain.setLayoutManager(new GridLayoutManager(this, 4)); rvMain.setHasFixedSize(true); rvMain.addItemDecoration(new GridItemDecoration(this, R.dimen.module_image_dimen_4, true)); seAdapter = new SeAdapter(); ViewHolderWrapper<ImageInfo> viewHolderWrapper = new ViewHolderWrapper<ImageInfo>() { @Override @NonNull public RVHolder onCreateViewHolder(@NonNull ViewGroup viewGroup) { return RVHolder.create(viewGroup, R.layout.module_image_item_image); } @Override public void onBindViewHolder(@NonNull RVHolder rvHolder, @NonNull ImageInfo imageInfo) { SimpleDraweeView imageView = rvHolder.getView(R.id.iv_image); FrescoUtil.with(MainActivity.this) .loadFile(imageInfo.getPath()) .resize(200, 200) .into(imageView); } }; // 设置点击 viewHolderWrapper.setOnItemClickListener(new ViewHolderWrapper.OnItemClickListener() { @Override public void onClick(RVHolder viewHolder, int position) { // ARouter.getInstance() // .build(RouterApi.ACTIVITY_IMAGE_PREVIEW) // .withInt("position", position) // .navigation(); } }); seAdapter.bind(ImageInfo.class, viewHolderWrapper); rvMain.setAdapter(seAdapter); }
private void loadImageIntoDrawee(SimpleDraweeView draweeView, @Nullable BytesRange bytesRange) { final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(URI) .setMediaVariationsForMediaId("partial") .setBytesRange(bytesRange) .build(); final DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setOldController(draweeView.getController()) .setImageRequest(imageRequest) .build(); draweeView.setController(draweeController); }
private void populateThumb(View rootView, @IdRes int viewId, final Size size) { final SimpleDraweeView draweeView = (SimpleDraweeView) rootView.findViewById(viewId); loadThumb(draweeView, size, ImageRequest.RequestLevel.DISK_CACHE); draweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadThumb(draweeView, size, ImageRequest.RequestLevel.FULL_FETCH); } }); }
private void populateMainImage(View rootView) { mMainImageDraweeView = (SimpleDraweeView) rootView.findViewById(R.id.img_main); loadMainImage(); mMainImageDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadMainImage(); } }); ResizableFrameLayout mainImageFrameLayout = (ResizableFrameLayout) rootView.findViewById(R.id.frame_main); mainImageFrameLayout.init(rootView.findViewById(R.id.btn_resize)); }
private void findDrawees(View view) { mDraweeRound = (SimpleDraweeView) view.findViewById(R.id.drawee_round); mDraweeRadius = (SimpleDraweeView) view.findViewById(R.id.drawee_radius); mDraweeSome = (SimpleDraweeView) view.findViewById(R.id.drawee_some); mDraweeSomeRtl = (SimpleDraweeView) view.findViewById(R.id.drawee_some_rtl); mDraweeFancy = (SimpleDraweeView) view.findViewById(R.id.drawee_fancy); }
private void setShowBorder(SimpleDraweeView draweeView, boolean show) { final RoundingParams roundingParams = Preconditions.checkNotNull(draweeView.getHierarchy().getRoundingParams()); if (show) { roundingParams.setBorder( mColorPrimary, getResources().getDimensionPixelSize(R.dimen.drawee_rounded_corners_border_width)); } else { roundingParams.setBorder(Color.TRANSPARENT, 0); } draweeView.getHierarchy().setRoundingParams(roundingParams); }
private void setUri(SimpleDraweeView draweeView, Uri uri, boolean retryEnabled) { draweeView.setController(Fresco.newDraweeControllerBuilder() .setOldController(draweeView.getController()) .setTapToRetryEnabled(retryEnabled) .setUri(uri) .build()); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) { View view = inflater.inflate(R.layout.fragment_welcome, container, false); sdvWelcomeAvatar = (SimpleDraweeView) view.findViewById(R.id.sdv_welcome_avatar); tvWelcome = (DCTextView) view.findViewById(R.id.tv_welcome); tvWelcomeName = (DCTextView) view.findViewById(R.id.tv_welcome_name); Resources r = getResources(); float translationPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, r.getDisplayMetrics()); AlphaAnimation avatarAnimation = new AlphaAnimation(0, 1); avatarAnimation.setDuration(2500); sdvWelcomeAvatar.startAnimation(avatarAnimation); TranslateAnimation welcomeAnimationTranslate = new TranslateAnimation(0, 0, translationPx, 0); welcomeAnimationTranslate.setDuration(1500); AlphaAnimation welcomeAnimationAlpha = new AlphaAnimation(0, 1); welcomeAnimationAlpha.setDuration(1500); AnimationSet welcomeAnimation = new AnimationSet(true); welcomeAnimation.addAnimation(welcomeAnimationAlpha); welcomeAnimation.addAnimation(welcomeAnimationTranslate); tvWelcome.startAnimation(welcomeAnimation); AlphaAnimation welcomeAnimationName = new AlphaAnimation(0, 1); welcomeAnimationName.setDuration(3000); tvWelcomeName.startAnimation(welcomeAnimationName); loadUser(); DCSharedPreferences.saveBoolean(DCSharedPreferences.DCSharedKey.WELCOME_SCREEN, true); return view; }