Example usage for android.widget ImageView getDrawable

List of usage examples for android.widget ImageView getDrawable

Introduction

In this page you can find the example usage for android.widget ImageView getDrawable.

Prototype

public Drawable getDrawable() 

Source Link

Document

Gets the current Drawable, or null if no Drawable has been assigned.

Usage

From source file:me.zchang.onchart.ui.adapter.CourseListAdapter.java

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
    if (holder instanceof ViewHolder) {
        ViewHolder viewHolder = (ViewHolder) holder;
        final LabelCourse course = (LabelCourse) courses.get(bitmap[position]);
        final TextView nameText = viewHolder.nameText;
        final TextView roomText = viewHolder.roomText;
        final TextView timeText = viewHolder.timeText;
        final ImageView nabImg = viewHolder.nabImg;
        final CardView cardView = viewHolder.cardView;
        final TextView backgroundIndicator = viewHolder.backgroundIndicator;
        nameText.setText(course.getName());
        roomText.setText(course.getClassroom());
        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.ENGLISH);
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
        timeText.setText(dateFormat.format(course.getStartTime()));

        ViewGroup.LayoutParams params = ((ViewHolder) holder).frame.getLayoutParams();
        params.height = (viewHolder.cardHeight >> 1)
                * (((int) course.getEndTime() - (int) course.getStartTime()) / Utils.MILLISECONDS_IN_ONE_CLASS
                        + 1);/*from   w w w.  j a v  a 2s.  c  o m*/
        ((ViewHolder) holder).frame.setLayoutParams(params);

        nabImg.setImageResource(ConfigManager.labelImgIndices[course.getLabelImgIndex()]);

        Drawable nab = nabImg.getDrawable();
        if (nab != null) {
            if ((course.getThemeColor() | course.getTimeColor() | course.getTitleColor()
                    | course.getSubTitleColor()) == 0) {
                new Palette.Builder(((BitmapDrawable) nab).getBitmap())
                        .generate(new Palette.PaletteAsyncListener() {
                            @Override
                            public void onGenerated(Palette palette) {
                                Palette.Swatch lightVibrant = palette.getLightVibrantSwatch();
                                Palette.Swatch vibrant = palette.getVibrantSwatch();
                                if (cardView != null) {
                                    if (lightVibrant != null) {
                                        cardView.setCardBackgroundColor(lightVibrant.getRgb());
                                        backgroundIndicator.setTextColor(lightVibrant.getRgb());
                                        nameText.setTextColor(lightVibrant.getTitleTextColor());
                                        roomText.setTextColor(lightVibrant.getBodyTextColor());

                                        course.setThemeColor(lightVibrant.getRgb())
                                                .setTitleColor(lightVibrant.getTitleTextColor())
                                                .setSubTitleColor(lightVibrant.getBodyTextColor());
                                    } else if (vibrant != null) {
                                        cardView.setCardBackgroundColor(vibrant.getRgb());
                                        backgroundIndicator.setTextColor(vibrant.getRgb());
                                        nameText.setTextColor(vibrant.getTitleTextColor());
                                        roomText.setTextColor(vibrant.getBodyTextColor());

                                        course.setThemeColor(vibrant.getRgb())
                                                .setTitleColor(vibrant.getTitleTextColor())
                                                .setSubTitleColor(vibrant.getBodyTextColor());
                                    } else {
                                        int defaultColor = ContextCompat.getColor(context,
                                                R.color.cardview_light_background);
                                        cardView.setCardBackgroundColor(defaultColor);
                                        backgroundIndicator.setTextColor(defaultColor);
                                        nameText.setTextColor(defaultColor);
                                        roomText.setTextColor(defaultColor);

                                        course.setThemeColor(defaultColor).setTitleColor(defaultColor)
                                                .setSubTitleColor(defaultColor);
                                    }
                                    if (vibrant != null) {
                                        timeText.setTextColor(vibrant.getRgb());
                                        course.setTimeColor(vibrant.getRgb());
                                    } else {
                                        timeText.setTextColor(
                                                ContextCompat.getColor(context, R.color.default_title));
                                        course.setTimeColor(
                                                ContextCompat.getColor(context, R.color.default_title));
                                    }
                                }
                            }

                        });
            } else if (cardView != null) {
                cardView.setCardBackgroundColor(course.getThemeColor());
                backgroundIndicator.setTextColor(course.getThemeColor());
                nameText.setTextColor(course.getTitleColor());
                roomText.setTextColor(course.getSubTitleColor());
                timeText.setTextColor(course.getTimeColor());
            }

        }

        if (cardView != null) {
            cardView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(context, DetailActivity.class);
                    intent.putExtra(context.getString(R.string.intent_frag_index), fragId);
                    intent.putExtra(context.getString(R.string.intent_position), position);
                    intent.putExtra(context.getString(R.string.intent_lesson), course);
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
                        intent.putExtra("color", backgroundIndicator.getTextColors().getDefaultColor());
                    else
                        intent.putExtra("color", 0xffffff);
                    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(
                            (Activity) context, Pair.create(v, context.getString(R.string.trans_detail_item)),
                            Pair.create(v.findViewById(R.id.iv_label),
                                    context.getString(R.string.trans_detail_img)));
                    ((Activity) context).startActivityForResult(intent, MainActivity.REQ_POSITION,
                            options.toBundle());
                }
            });
        }
    } else if (holder instanceof SubtitleViewHolder) {
        if (MORNING_FLAG == bitmap[position]) {
            ((SubtitleViewHolder) holder).subTitle
                    .setText(context.getResources().getString(me.zchang.onchart.R.string.subtitle_morning));
        } else if (AFTERNOON_FLAG == bitmap[position]) {
            ((SubtitleViewHolder) holder).subTitle
                    .setText(context.getResources().getString(me.zchang.onchart.R.string.subtitle_afternoon));
        } else if (EVENING_FLAG == bitmap[position]) {
            ((SubtitleViewHolder) holder).subTitle
                    .setText(context.getResources().getString(me.zchang.onchart.R.string.subtitle_evening));
        }
    }
}

From source file:com.htc.dotdesign.ToolBoxService.java

private void initBrushColor() {
    Resources res = getResources();

    final int size = 4 * 3;
    int[] btn_id = new int[size];
    btn_id[0] = R.id.btn_color_11;//  w  w  w  . j  ava2 s  . co m
    btn_id[1] = R.id.btn_color_12;
    btn_id[2] = R.id.btn_color_13;
    btn_id[3] = R.id.btn_color_14;
    btn_id[4] = R.id.btn_color_21;
    btn_id[5] = R.id.btn_color_22;
    btn_id[6] = R.id.btn_color_23;
    btn_id[7] = R.id.btn_color_24;
    btn_id[8] = R.id.btn_color_31;
    btn_id[9] = R.id.btn_color_32;
    btn_id[10] = R.id.btn_color_33;
    btn_id[11] = R.id.btn_color_34;

    int[] color_id = new int[size];
    color_id[0] = R.color.palette_color_11;
    color_id[1] = R.color.palette_color_12;
    color_id[2] = R.color.palette_color_13;
    color_id[3] = R.color.palette_color_14;
    color_id[4] = R.color.palette_color_21;
    color_id[5] = R.color.palette_color_22;
    color_id[6] = R.color.palette_color_23;
    color_id[7] = R.color.palette_color_24;
    color_id[8] = R.color.palette_color_31;
    color_id[9] = R.color.palette_color_32;
    color_id[10] = R.color.palette_color_33;
    color_id[11] = R.color.palette_color_34;

    if (res != null) {
        ImageView button = null;
        GradientDrawable drawable = null;
        for (int i = 0; i < size; i++) {
            button = (ImageView) mPalette.findViewById(btn_id[i]);
            if (button != null) {
                drawable = (GradientDrawable) button.getDrawable();
                drawable.setColor(res.getColor(color_id[i]));
                mBtnColor.put(btn_id[i], res.getColor(color_id[i]));
                button.setOnClickListener(mButtonListener);

                if (i == 0) {
                    mCurrBrushColorView = button;
                    mCurrBrushColor = res.getColor(color_id[i]);
                    setSelectedColor(mCurrBrushColorView);
                }
            }
        }
    }
}

From source file:org.telegram.ui.Components.ShareAlert.java

public ShareAlert(final Context context, MessageObject messageObject, final String text, boolean publicChannel,
        final String copyLink) {
    super(context, true);

    shadowDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow);

    linkToCopy = copyLink;/*  ww  w .  j  a  v a  2 s.c o m*/
    sendingMessageObject = messageObject;
    searchAdapter = new ShareSearchAdapter(context);
    isPublicChannel = publicChannel;
    sendingText = text;

    if (publicChannel) {
        loadingLink = true;
        TLRPC.TL_channels_exportMessageLink req = new TLRPC.TL_channels_exportMessageLink();
        req.id = messageObject.getId();
        req.channel = MessagesController.getInputChannel(messageObject.messageOwner.to_id.channel_id);
        ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
            @Override
            public void run(final TLObject response, TLRPC.TL_error error) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        if (response != null) {
                            exportedMessageLink = (TLRPC.TL_exportedMessageLink) response;
                            if (copyLinkOnEnd) {
                                copyLink(context);
                            }
                        }
                        loadingLink = false;
                    }
                });
            }
        });
    }

    containerView = new FrameLayout(context) {

        private boolean ignoreLayout = false;

        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            if (ev.getAction() == MotionEvent.ACTION_DOWN && scrollOffsetY != 0 && ev.getY() < scrollOffsetY) {
                dismiss();
                return true;
            }
            return super.onInterceptTouchEvent(ev);
        }

        @Override
        public boolean onTouchEvent(MotionEvent e) {
            return !isDismissed() && super.onTouchEvent(e);
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            int height = MeasureSpec.getSize(heightMeasureSpec);
            if (Build.VERSION.SDK_INT >= 21) {
                height -= AndroidUtilities.statusBarHeight;
            }
            int size = Math.max(searchAdapter.getItemCount(), listAdapter.getItemCount());
            int contentSize = AndroidUtilities.dp(48)
                    + Math.max(3, (int) Math.ceil(size / 4.0f)) * AndroidUtilities.dp(100)
                    + backgroundPaddingTop;
            int padding = contentSize < height ? 0 : height - (height / 5 * 3) + AndroidUtilities.dp(8);
            if (gridView.getPaddingTop() != padding) {
                ignoreLayout = true;
                gridView.setPadding(0, padding, 0, AndroidUtilities.dp(8));
                ignoreLayout = false;
            }
            super.onMeasure(widthMeasureSpec,
                    MeasureSpec.makeMeasureSpec(Math.min(contentSize, height), MeasureSpec.EXACTLY));
        }

        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            updateLayout();
        }

        @Override
        public void requestLayout() {
            if (ignoreLayout) {
                return;
            }
            super.requestLayout();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            shadowDrawable.setBounds(0, scrollOffsetY - backgroundPaddingTop, getMeasuredWidth(),
                    getMeasuredHeight());
            shadowDrawable.draw(canvas);
        }
    };
    containerView.setWillNotDraw(false);
    containerView.setPadding(backgroundPaddingLeft, 0, backgroundPaddingLeft, 0);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.background));
    frameLayout.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(
            Theme.createBarSelectorDrawable(Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(21), 0, AndroidUtilities.dp(21), 0);
    frameLayout.addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));
    doneButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (selectedDialogs.isEmpty() && (isPublicChannel || linkToCopy != null)) {
                if (linkToCopy == null && loadingLink) {
                    copyLinkOnEnd = true;
                    Toast.makeText(ShareAlert.this.getContext(),
                            LocaleController.getString("Loading", R.string.Loading), Toast.LENGTH_SHORT).show();
                } else {
                    copyLink(ShareAlert.this.getContext());
                }
                dismiss();
            } else {
                if (sendingMessageObject != null) {
                    ArrayList<MessageObject> arrayList = new ArrayList<>();
                    arrayList.add(sendingMessageObject);
                    for (HashMap.Entry<Long, TLRPC.TL_dialog> entry : selectedDialogs.entrySet()) {
                        SendMessagesHelper.getInstance().sendMessage(arrayList, entry.getKey());
                    }
                } else if (sendingText != null) {
                    for (HashMap.Entry<Long, TLRPC.TL_dialog> entry : selectedDialogs.entrySet()) {
                        SendMessagesHelper.getInstance().sendMessage(sendingText, entry.getKey(), null, null,
                                true, null, null, null);
                    }
                }
                dismiss();
            }
        }
    });

    doneButtonBadgeTextView = new TextView(context);
    doneButtonBadgeTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    doneButtonBadgeTextView.setTextColor(Theme.SHARE_SHEET_BADGE_TEXT_COLOR);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(R.drawable.bluecounter);
    doneButtonBadgeTextView.setMinWidth(AndroidUtilities.dp(23));
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8),
            AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView,
            LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 23, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));

    ImageView imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.search_share);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    imageView.getDrawable().setTint(Theme.SHARE_SHEET_EDIT_PLACEHOLDER_TEXT_COLOR);
    frameLayout.addView(imageView, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    nameTextView = new EditText(context);
    nameTextView.setHint(LocaleController.getString("ShareSendTo", R.string.ShareSendTo));
    nameTextView.setMaxLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    nameTextView.setBackgroundDrawable(null);
    nameTextView.setHintTextColor(Theme.SHARE_SHEET_EDIT_PLACEHOLDER_TEXT_COLOR);
    nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    nameTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
    AndroidUtilities.clearCursorDrawable(nameTextView);
    nameTextView.setTextColor(Theme.SHARE_SHEET_EDIT_TEXT_COLOR);
    frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 48, 2, 96, 0));
    nameTextView.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }

        @Override
        public void afterTextChanged(Editable s) {
            String text = nameTextView.getText().toString();
            if (text.length() != 0) {
                if (gridView.getAdapter() != searchAdapter) {
                    topBeforeSwitch = getCurrentTop();
                    gridView.setAdapter(searchAdapter);
                    searchAdapter.notifyDataSetChanged();
                }
                if (searchEmptyView != null) {
                    searchEmptyView.setText(LocaleController.getString("NoResult", R.string.NoResult));
                }
            } else {
                if (gridView.getAdapter() != listAdapter) {
                    int top = getCurrentTop();
                    searchEmptyView.setText(LocaleController.getString("NoChats", R.string.NoChats));
                    gridView.setAdapter(listAdapter);
                    listAdapter.notifyDataSetChanged();
                    if (top > 0) {
                        layoutManager.scrollToPositionWithOffset(0, -top);
                    }
                }
            }
            if (searchAdapter != null) {
                searchAdapter.searchDialogs(text);
            }
        }
    });

    gridView = new RecyclerListView(context);
    gridView.setTag(13);
    gridView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
    gridView.setClipToPadding(false);
    gridView.setLayoutManager(layoutManager = new GridLayoutManager(getContext(), 4));
    gridView.setHorizontalScrollBarEnabled(false);
    gridView.setVerticalScrollBarEnabled(false);
    gridView.addItemDecoration(new RecyclerView.ItemDecoration() {
        @Override
        public void getItemOffsets(android.graphics.Rect outRect, View view, RecyclerView parent,
                RecyclerView.State state) {
            Holder holder = (Holder) parent.getChildViewHolder(view);
            if (holder != null) {
                int pos = holder.getAdapterPosition();
                outRect.left = pos % 4 == 0 ? 0 : AndroidUtilities.dp(4);
                outRect.right = pos % 4 == 3 ? 0 : AndroidUtilities.dp(4);
            } else {
                outRect.left = AndroidUtilities.dp(4);
                outRect.right = AndroidUtilities.dp(4);
            }
        }
    });
    containerView.addView(gridView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0));
    gridView.setAdapter(listAdapter = new ShareDialogsAdapter(context));
    gridView.setGlowColor(0xfff5f6f7);
    gridView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (position < 0) {
                return;
            }
            TLRPC.TL_dialog dialog;
            if (gridView.getAdapter() == listAdapter) {
                dialog = listAdapter.getItem(position);
            } else {
                dialog = searchAdapter.getItem(position);
            }
            if (dialog == null) {
                return;
            }
            ShareDialogCell cell = (ShareDialogCell) view;
            if (selectedDialogs.containsKey(dialog.id)) {
                selectedDialogs.remove(dialog.id);
                cell.setChecked(false, true);
            } else {
                selectedDialogs.put(dialog.id, dialog);
                cell.setChecked(true, true);
            }
            updateSelectedCount();
        }
    });
    gridView.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            updateLayout();
        }
    });

    searchEmptyView = new EmptyTextProgressView(context);
    searchEmptyView.setShowAtCenter(true);
    searchEmptyView.showTextView();
    searchEmptyView.setText(LocaleController.getString("NoChats", R.string.NoChats));
    gridView.setEmptyView(searchEmptyView);
    containerView.addView(searchEmptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0));

    containerView.addView(frameLayout,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.TOP));

    shadow = new View(context);
    shadow.setBackgroundResource(R.drawable.header_shadow);
    containerView.addView(shadow,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.TOP | Gravity.LEFT, 0, 48, 0, 0));

    updateSelectedCount();

    if (!DialogsActivity.dialogsLoaded) {
        MessagesController.getInstance().loadDialogs(0, 100, true);
        ContactsController.getInstance().checkInviteText();
        DialogsActivity.dialogsLoaded = true;
    }
    if (listAdapter.dialogs.isEmpty()) {
        NotificationCenter.getInstance().addObserver(this, NotificationCenter.dialogsNeedReload);
    }
}

From source file:com.android.incallui.CallCardFragment.java

/**
 * Helper method for image view to handle animations.
 *
 * @param view The image view to show or hide.
 * @param isVisible {@code true} if we want to show the image, {@code false} to hide it.
 *///ww  w  . j a va 2 s. c  o  m
private void showImageView(ImageView view, boolean isVisible) {
    if (view.getDrawable() == null) {
        if (isVisible) {
            AnimUtils.fadeIn(mElapsedTime, AnimUtils.DEFAULT_DURATION);
        }
    } else {
        // Cross fading is buggy and not noticeable due to the multiple calls to this method
        // that switch drawables in the middle of the cross-fade animations. Just show the
        // photo directly instead.
        view.setVisibility(isVisible ? View.VISIBLE : View.GONE);
    }
}

From source file:org.runbuddy.tomahawk.ui.fragments.ContextMenuFragment.java

/**
 * Initializes the "Add to playlist"-context-menu-button.
 *
 * @param view    this Fragment's root View
 * @param queries the List of {@link Query}s that should be added to one of the user's playlists
 *                once he taps the "add to playlist-context-menu-button. If this List is null
 *                the button will show up as disabled and greyed out. If this List is empty the
 *                button won't be displayed at all.
 *///ww  w. j a va2s .c om
private void setupAddToPlaylistButton(View view, final List<Query> queries) {
    View v = ViewUtils.ensureInflation(view, R.id.context_menu_addtoplaylist_stub,
            R.id.context_menu_addtoplaylist);
    if (queries != null && queries.size() == 0) {
        v.setVisibility(View.GONE);
    } else {
        TextView textView = (TextView) v.findViewById(R.id.textview);
        ImageView imageView = (ImageView) v.findViewById(R.id.imageview);
        imageView.setImageResource(R.drawable.ic_action_playlist);
        textView.setText(R.string.context_menu_add_to_playlist);
        if (queries != null) {
            v.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    getActivity().getSupportFragmentManager().popBackStack();
                    showAddToPlaylist((TomahawkMainActivity) getActivity(), queries);
                }
            });
            textView.setTextColor(getResources().getColor(R.color.primary_textcolor_inverted));
            ImageUtils.setTint(imageView.getDrawable(), R.color.primary_textcolor_inverted);
        } else {
            textView.setTextColor(getResources().getColor(R.color.disabled));
            ImageUtils.setTint(imageView.getDrawable(), R.color.disabled);
        }
    }
}

From source file:com.zero.pictureselect.Photoview.PhotoViewAttacher.java

public void update() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            // Make sure we using MATRIX Scale Type
            setImageViewScaleTypeMatrix(imageView);

            // Update the base matrix using the current drawable
            updateBaseMatrix(imageView.getDrawable());//ScaleType
        } else {/*from   w  w w  .j  a va 2s. c om*/
            // Reset the Matrix...
            resetMatrix();
        }
    }
}

From source file:cn.golden.pinchzoomcanvasview.PinchZoomCanvasViewAttacher.java

public void update() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            // Make sure we using MATRIX Scale Type
            setImageViewScaleTypeMatrix(imageView);

            // Update the base matrix using the current drawable
            updateBaseMatrix(imageView.getDrawable());
        } else {/*from  ww w  .j a v  a  2  s. co m*/
            // Reset the Matrix...
            //                resetMatrix(); //modify
        }
    }
}

From source file:baizhuan.hangzhou.com.gankcopy.view.customview.photoview.PhotoViewAttacher.java

public void update() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            // Make sure we using MATRIX Scale Type
            setImageViewScaleTypeMatrix(imageView);

            // Update the base matrix using the current drawable
            updateBaseMatrix(imageView.getDrawable());
        } else {/*from w  w  w .  j  a v  a2 s  .  c  o m*/
            // Reset the Matrix...
            resetMatrix();
        }
    }
}

From source file:com.mooc.viewpage_photoview_circleindicator.photoview.PhotoViewAttacher.java

public void update() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            // Make sure we using MATRIX Scale Type
            setImageViewScaleTypeMatrix(imageView);

            // Update the base matrix using the current drawable
            updateBaseMatrix(imageView.getDrawable(), true);
        } else {/*from   w w w  . j a  va2s  .  c o  m*/
            // Reset the Matrix...
            resetMatrix();
        }
    }
}

From source file:mobisocial.musubi.ImageGalleryActivity.java

void injectImage(Uri fileUri, final ImageView imageView, final DbObj mObj) {
    try {/*from w  w w . j a v  a2 s  .co  m*/
        if ((Long) imageView.getTag() == mObj.getLocalId()) {
            if (DBG)
                Log.d(TAG, "Opening HD file " + fileUri);

            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if ((Long) imageView.getTag() == mObj.getLocalId()) {
                        cleanCorralImage();
                    }
                }
            });

            final BitmapDrawable image = getBitmap(fileUri);
            if (image == null) {
                return;
            }

            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if ((Long) imageView.getTag() == mObj.getLocalId()) {
                        mCorralImage = image;
                        mOriginalImage = (BitmapDrawable) imageView.getDrawable();
                        mCorralView = imageView;
                        imageView.setImageDrawable(image);
                    }
                }
            });
        }
    } catch (OutOfMemoryError e) {
        App.getUsageMetrics(this).report(e);
        Log.e(TAG, "error loading data from corral", e);
    }
}