android.support.v7.widget.AppCompatImageView Java Examples

The following examples show how to use android.support.v7.widget.AppCompatImageView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Luhn.java    From Luhn with MIT License 6 votes vote down vote up
private void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
    hideKeyboard();
    AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
    AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
    AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
    if (error) {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
    } else {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
    }

    infoHeader.setText(header);
    infoDesc.setText(desc);
    if (drawable != null)
        infoImg.setImageDrawable(drawable);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
Example #2
Source File: InstaLikeView.java    From InstaLikeView with Apache License 2.0 6 votes vote down vote up
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    mImageHeart = new AppCompatImageView(context);
    TypedArray a = context.getTheme().obtainStyledAttributes(
            attrs,
            R.styleable.InstaLikeView,
            defStyleAttr, 0);

    int likeColor = a.getColor(R.styleable.InstaLikeView_likeColor, ContextCompat.getColor(context, R.color.heartColor));
    int likeSrc = a.getResourceId(R.styleable.InstaLikeView_likeSrc, R.drawable.img_heart);
    int likeSize = a.getDimensionPixelSize(R.styleable.InstaLikeView_likeSize, getResources().getDimensionPixelSize(R.dimen.likeSize));


    LayoutParams heartParams = new LayoutParams(likeSize, likeSize);
    heartParams.addRule(CENTER_IN_PARENT, TRUE);

    mImageHeart.setLayoutParams(heartParams);
    mImageHeart.setVisibility(GONE);
    mImageHeart.setImageResource(likeSrc);
    mImageHeart.setColorFilter(likeColor);
    addView(mImageHeart);
}
 
Example #3
Source File: BottomBarBadge.java    From BottomBar with Apache License 2.0 6 votes vote down vote up
void adjustPositionAndSize(BottomBarTab tab) {
    AppCompatImageView iconView = tab.getIconView();
    ViewGroup.LayoutParams params = getLayoutParams();

    int size = Math.max(getWidth(), getHeight());
    float xOffset = (float) (iconView.getWidth() / 1.25);

    setX(iconView.getX() + xOffset);
    setTranslationY(10);

    if (params.width != size || params.height != size) {
        params.width = size;
        params.height = size;
        setLayoutParams(params);
    }
}
 
Example #4
Source File: BottomBarTab.java    From BottomBar with Apache License 2.0 6 votes vote down vote up
void prepareLayout() {
    inflate(getContext(), getLayoutResource(), this);
    setOrientation(VERTICAL);
    setGravity(isTitleless? Gravity.CENTER : Gravity.CENTER_HORIZONTAL);
    setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    setBackgroundResource(MiscUtils.getDrawableRes(getContext(), R.attr.selectableItemBackgroundBorderless));

    iconView = (AppCompatImageView) findViewById(R.id.bb_bottom_bar_icon);
    iconView.setImageResource(iconResId);

    if (type != Type.TABLET && !isTitleless) {
        titleView = (TextView) findViewById(R.id.bb_bottom_bar_title);
        titleView.setVisibility(VISIBLE);

        if (type == Type.SHIFTING) {
            findViewById(R.id.spacer).setVisibility(VISIBLE);
        }

        updateTitle();
    }

    updateCustomTextAppearance();
    updateCustomTypeface();
}
 
Example #5
Source File: RecyclerViewBanner.java    From RecyclerViewBanner with Apache License 2.0 6 votes vote down vote up
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    AppCompatImageView img = new AppCompatImageView(parent.getContext());
    RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    img.setLayoutParams(params);
    img.setId(R.id.rvb_banner_image_view_id);
    img.setScaleType(AppCompatImageView.ScaleType.CENTER_CROP);
    img.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (onRvBannerClickListener != null) {
                onRvBannerClickListener.onClick(currentIndex % mData.size());
            }
        }
    });
    return new RecyclerView.ViewHolder(img) {
    };
}
 
Example #6
Source File: ToolbarContentTintHelper.java    From APlayer with GNU General Public License v3.0 6 votes vote down vote up
public static void setOverflowButtonColor(@NonNull Activity activity,
    final @ColorInt int color) {
  final String overflowDescription = activity
      .getString(R.string.abc_action_menu_overflow_description);
  final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
  final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
  viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    @Override
    public void onGlobalLayout() {
      final ArrayList<View> outViews = new ArrayList<>();
      decorView.findViewsWithText(outViews, overflowDescription,
          View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
      if (outViews.isEmpty()) {
        return;
      }
      final AppCompatImageView overflow = (AppCompatImageView) outViews.get(0);
      overflow.setImageDrawable(TintHelper.createTintedDrawable(overflow.getDrawable(), color));
      decorView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
    }
  });
}
 
Example #7
Source File: AddTagAdapter.java    From com.ruuvi.station with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    final RuuviTag tag = getItem(position);

    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_item_add, parent, false);
    }

    ((TextView)convertView.findViewById(R.id.address)).setText(tag.id);
    ((TextView)convertView.findViewById(R.id.rssi)).setText(String.format(getContext().getResources().getString(R.string.signal_reading), tag.rssi));

    AppCompatImageView signalIcon = convertView.findViewById(R.id.signalIcon);
    if (tag.rssi < -80) signalIcon.setImageResource(R.drawable.icon_connection_1);
    else if (tag.rssi < -50) signalIcon.setImageResource(R.drawable.icon_connection_2);
    else signalIcon.setImageResource(R.drawable.icon_connection_3);

    return convertView;
}
 
Example #8
Source File: RecyclerViewBanner.java    From RecyclerViewBanner with Apache License 2.0 6 votes vote down vote up
/**
 * 指示器整体由数据列表容量数量的AppCompatImageView均匀分布在一个横向的LinearLayout中构成
 * 使用AppCompatImageView的好处是在Fragment中也使用Compat相关属性
 */
private void createIndicators() {
    mLinearLayout.removeAllViews();
    for (int i = 0; i < mData.size(); i++) {
        AppCompatImageView img = new AppCompatImageView(getContext());
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        lp.leftMargin = mSpace / 2;
        lp.rightMargin = mSpace / 2;
        if (mSize >= dp2px(4)) { // 设置了indicatorSize属性
            lp.width = lp.height = mSize;
        } else {
            // 如果设置的resource.xml没有明确的宽高,默认最小2dp,否则太小看不清
            img.setMinimumWidth(dp2px(2));
            img.setMinimumHeight(dp2px(2));
        }
        img.setImageDrawable(i == 0 ? mSelectedDrawable : mUnselectedDrawable);
        mLinearLayout.addView(img, lp);
    }
}
 
Example #9
Source File: ToolbarColorizeHelper.java    From IdeaTrackerPlus with MIT License 6 votes vote down vote up
/**
 * It's important to set overflowDescription atribute in styles, so we can grab the reference
 * to the overflow icon. Check: res/values/styles.xml
 *
 * @param activity
 * @param colorFilter
 */
private static void setOverflowButtonColor(final Activity activity, final PorterDuffColorFilter colorFilter) {
    final String overflowDescription = activity.getString(R.string.abc_action_menu_overflow_description);
    final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    final ViewTreeObserver viewTreeObserver = decorView.getViewTreeObserver();
    viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            final ArrayList<View> outViews = new ArrayList<View>();
            decorView.findViewsWithText(outViews, overflowDescription,
                    View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
            if (outViews.isEmpty()) {
                return;
            }
            AppCompatImageView overflow = (AppCompatImageView) outViews.get(0);
            overflow.setColorFilter(colorFilter);
            removeOnGlobalLayoutListener(decorView, this);
        }
    });
}
 
Example #10
Source File: DetailActivity.java    From Puff-Android with MIT License 6 votes vote down vote up
private void wireUpViews(){
    tvAccount = (AppCompatTextView) findViewById(R.id.account);
    tvPasswd = (AppCompatTextView) findViewById(R.id.password);
    tvAdditional = (AppCompatTextView) findViewById(R.id.additional);
    tvTitle = (AppCompatTextView) findViewById(R.id.id_name);
    image = (AppCompatImageView) findViewById(R.id.account_image);
    tvWebSite = (AppCompatTextView) findViewById(R.id.id_website_link);
    tvWebSiteTitle = (AppCompatTextView) findViewById(R.id.website_title);
    webSiteContainer = (LinearLayout) findViewById(R.id.website_container);
    tvLastAccess = (AppCompatTextView) findViewById(R.id.last_accessed);

    webSiteContainer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String url = account.getWebsite();
            if (!url.startsWith("http://") && !url.startsWith("https://"))
                url = "http://" + url;

            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });
}
 
Example #11
Source File: RadioRealButton.java    From RadioRealButton with Apache License 2.0 6 votes vote down vote up
private void initViews() {
    setLayoutParams(new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
    setOrientation(HORIZONTAL);
    setGravity(Gravity.CENTER);

    imageView = new AppCompatImageView(getContext());
    imageView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {{
        gravity = Gravity.CENTER;
    }});
    setDrawableAttrs();
    addView(imageView);

    textView = new AppCompatTextView(getContext());
    textView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) {{
        gravity = Gravity.CENTER;
    }});
    setTextAttrs();
    addView(textView);
}
 
Example #12
Source File: RadioRealButton.java    From RadioRealButton with Apache License 2.0 6 votes vote down vote up
private void updatePadding(View view, boolean hasOtherView) {
    if (null == view)
        return;

    int[] paddings = {paddingLeft, paddingTop, paddingRight, paddingBottom};

    if (hasOtherView) {
        int g = drawableGravity.getIntValue();
        if (view instanceof AppCompatImageView) {
            g = g > 1 ? g - 2 : g + 2;
        }
        paddings[g] = drawablePadding / 2;
    }

    MarginLayoutParams params = (MarginLayoutParams) view.getLayoutParams();
    params.setMargins(paddings[0], paddings[1], paddings[2], paddings[3]);
}
 
Example #13
Source File: RecyclerImageAdapter.java    From FastWaiMai with MIT License 6 votes vote down vote up
@Override
protected void convert(MultipleViewHolder holder, MultipleItemEntity entity) {
    switch (holder.getItemViewType()){
        case ItemType.SINGLE_BIG_IMAGE:
            final AppCompatImageView view = holder.getView(R.id.image_rv_item);
            final String url = entity.getField(MultipleFields.IMAGE_URL);
            Glide.with(mContext)
                    .load(url)
                    .apply(OPTIONS)
                    .into(view);
            break;
        default:
            break;

    }
}
 
Example #14
Source File: BaseActivity.java    From africastalking-android with MIT License 6 votes vote down vote up
protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) {
    hideKeyboard();
    AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header);
    AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc);
    AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img);
    if (error) {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close");
    } else {
        llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE);
        ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok");
    }

    infoHeader.setText(header);
    infoDesc.setText(desc);
    if (drawable != null)
        infoImg.setImageDrawable(drawable);
    bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
}
 
Example #15
Source File: PhotoLayout.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
private void initPreContainer(){
    preContainer=new LinearLayout(getContext());
    preContainer.setOrientation(LinearLayout.HORIZONTAL);
    LayoutParams lp=new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.gravity=Gravity.CENTER_VERTICAL;
    preContainer.setLayoutParams(lp);
    preContainer.setOnClickListener(this);
    AppCompatImageView tmpImageView=new AppCompatImageView(getContext());
    tmpImageView.setBackgroundResource(R.mipmap.ic_image_black_24dp);
    AppCompatTextView tmpTextView=new AppCompatTextView(getContext());
    LinearLayout.LayoutParams lp1=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp1.gravity=Gravity.CENTER_VERTICAL;
    tmpImageView.setLayoutParams(lp1);
    tmpTextView.setLayoutParams(lp1);
    tmpTextView.setText(getContext().getString(R.string.select_photo));
    preContainer.addView(tmpImageView);
    preContainer.addView(tmpTextView);
    this.addView(preContainer);
}
 
Example #16
Source File: PhotoLayout.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
private void initImgContainer(){
    LinearLayout linearLayout=new LinearLayout(getContext());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    imageView=new AppCompatImageView(getContext());
    LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    imageView.setLayoutParams(lp);
    linearLayout.addView(imageView);
    imageView.setOnClickListener(this);
    editText=new AppCompatEditText(getContext());
    linearLayout.addView(editText);
    editText.setVisibility(GONE);
    editText.setTextAppearance(getContext(),R.style.NoteTextAppearance);
    editText.setGravity(Gravity.CENTER);
    editText.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if(keyCode==KeyEvent.KEYCODE_DEL&&editText.getText().toString().isEmpty()){
                editText.setVisibility(GONE);
            }
            return false;
        }
    });
    this.addView(linearLayout);
}
 
Example #17
Source File: MusicPlayer.java    From always-on-amoled with GNU General Public License v3.0 5 votes vote down vote up
private void updatePlayPauseButton(boolean reverse) {
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    if (!am.isMusicActive())
        ((AppCompatImageView) findViewById(R.id.play)).setImageResource(reverse ? R.drawable.ic_play : R.drawable.ic_pause);
    else
        ((AppCompatImageView) findViewById(R.id.play)).setImageResource(reverse ? R.drawable.ic_pause : R.drawable.ic_play);
}
 
Example #18
Source File: SideBarArrow.java    From AndroidSideBar with Apache License 2.0 5 votes vote down vote up
public LinearLayout getView(Context context,boolean left,WindowManager windowManager,SideBarService sideBarService) {
    mContext = context;
    mLeft = left;
    mWindowManager = windowManager;
    mSideBarService = sideBarService;
    mParams = new WindowManager.LayoutParams();
    // compatible
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
    } else {
        mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
    }
    // set bg transparent
    mParams.format = PixelFormat.RGBA_8888;
    // can not focusable
    mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    mParams.x = 0;
    mParams.y = 0;
    // window size
    mParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    mParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    // get layout
    LayoutInflater inflater = LayoutInflater.from(context);
    mArrowView = (LinearLayout) inflater.inflate(R.layout.layout_arrow, null);
    AppCompatImageView arrow = mArrowView.findViewById(R.id.arrow);
    arrow.setOnClickListener(this);
    if(left) {
        arrow.setRotation(180);
        mParams.gravity = Gravity.START | Gravity.CENTER_VERTICAL;
        mParams.windowAnimations = R.style.LeftSeekBarAnim;
    }else {
        mParams.gravity = Gravity.END | Gravity.CENTER_VERTICAL;
        mParams.windowAnimations = R.style.RightSeekBarAnim;
    }
    mWindowManager.addView(mArrowView,mParams);
    return mArrowView;
}
 
Example #19
Source File: RecyclerViewBanner.java    From RecyclerViewBanner with Apache License 2.0 5 votes vote down vote up
/**
 * 改变导航的指示点
 */
private void switchIndicator() {
    if (mLinearLayout != null && mLinearLayout.getChildCount() > 0) {
        for (int i = 0; i < mLinearLayout.getChildCount(); i++) {
            ((AppCompatImageView) mLinearLayout.getChildAt(i)).setImageDrawable(
                    i == currentIndex % mData.size() ? mSelectedDrawable : mUnselectedDrawable);
        }
    }
}
 
Example #20
Source File: ProSwipeButton.java    From proSwipeButton with MIT License 5 votes vote down vote up
public void showResultIcon(boolean isSuccess, boolean shouldReset) {
    animateFadeHide(context, progressBar);

    final AppCompatImageView failureIcon = new AppCompatImageView(context);
    RelativeLayout.LayoutParams icLayoutParams =
            new RelativeLayout.LayoutParams(dpToPx(50), dpToPx(50));
    failureIcon.setLayoutParams(icLayoutParams);
    failureIcon.setVisibility(GONE);
    int icon;
    if (isSuccess)
        icon = R.drawable.ic_check_circle_36dp;
    else
        icon = R.drawable.ic_cancel_full_24dp;
    failureIcon.setImageResource(icon);
    contentContainer.addView(failureIcon);
    animateFadeShow(context, failureIcon);

    if (shouldReset) {
        // expand the btn again
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                animateFadeHide(context, failureIcon);
                morphToRect();
                arrowHintContainer.setX(0);
                animateFadeShow(context, arrowHintContainer);
                animateFadeShow(context, contentTv);
            }
        }, 1000);
    }
}
 
Example #21
Source File: RecyclerViewBanner.java    From RecyclerViewBanner with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    AppCompatImageView img = (AppCompatImageView) holder.itemView.findViewById(R.id.rvb_banner_image_view_id);
    if (onSwitchRvBannerListener != null) {
        onSwitchRvBannerListener.switchBanner(position % mData.size(), img);
    }
}
 
Example #22
Source File: SampleListStepDefinitions.java    From material-activity-chooser with Apache License 2.0 5 votes vote down vote up
@Then("^I should see a custom empty view layout$")
public void i_should_see_a_custom_empty_view_layout() {
    onView(
            allOf(
                    withParent(withId(R.id.mac_empty_view)),
                    withClassName(is(AppCompatImageView.class.getName()))
            )
    ).check(matches(isDisplayed()));
}
 
Example #23
Source File: SetMasterPasswordActivity.java    From Puff-Android with MIT License 5 votes vote down vote up
private void initReference(){
        passwd = (AppCompatEditText) findViewById(R.id.password);
        confirm = (AppCompatEditText) findViewById(R.id.confirm);
        confirmImgView = (AppCompatImageView) findViewById(R.id.confirm_img);
//        checkBox = (AnimateCheckBox) findViewById(R.id.quick_checkbox);
//        checkBoxHint = (AppCompatTextView) findViewById(R.id.checkbox_hint);
        helpText = (TextView) findViewById(R.id.help_text);
    }
 
Example #24
Source File: AddAccountActivity.java    From Puff-Android with MIT License 5 votes vote down vote up
private void wireViews() {
    name = (EditText) findViewById(R.id.id_name);
    account = (EditText) findViewById(R.id.account);
    password = (EditText) findViewById(R.id.password);
    addtional = (EditText) findViewById(R.id.additional);
    imageView = (AppCompatImageView) findViewById(R.id.account_image);
    website = (EditText) findViewById(R.id.website);
    generateButton = (AppCompatButton) findViewById(R.id.generate_button);
}
 
Example #25
Source File: LogOnActivity.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
void getDefinition()
{
    mLogOnButton=(AppCompatImageView)this.findViewById(R.id.account_sign_in_button);
    mRegisterButton = (AppCompatButton)findViewById(R.id.account_register_button);
    passwordEditText=((EditText)this.findViewById(R.id.password));
    tv_find_password = ((AppCompatTextView) this.findViewById(R.id.tv_find_password));
    tv_quick_log_on = ((AppCompatTextView) this.findViewById(R.id.tv_quick_log_on));

}
 
Example #26
Source File: UpFilesListHolder.java    From ExFilePicker with MIT License 5 votes vote down vote up
public UpFilesListHolder(@NonNull View itemView) {
    super(itemView);
    mFileName = (AppCompatTextView) itemView.findViewById(R.id.filename);
    mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.checkbox);
    mFileSize = (AppCompatTextView) itemView.findViewById(R.id.filesize);
    mThumbnail = (AppCompatImageView) itemView.findViewById(R.id.thumbnail);
}
 
Example #27
Source File: HeaderDialog.java    From HeaderDialog with MIT License 5 votes vote down vote up
private void init(Context context) {
    View view = LayoutInflater.from(context).inflate(R.layout.header_dialog_content, null);
    ctvj = (ContentTextViewJustified) view.findViewById(R.id.content_justified);
    ctv = (ContentTextView) view.findViewById(R.id.content);
    tv = (TitleTextView) view.findViewById(R.id.title);
    tv.setGravity(Gravity.CENTER_HORIZONTAL);
    ctv.setMovementMethod(LinkMovementMethod.getInstance());
    iv = (AppCompatImageView) view.findViewById(R.id.icon);
    ly = (LinearLayout) view.findViewById(R.id.layout);
    shadow = view.findViewById(R.id.top_shadow);
    customLayout = (LinearLayout) view.findViewById(R.id.contentView);
    setView(view);
}
 
Example #28
Source File: MainActivity.java    From Android-9-Development-Cookbook with MIT License 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == PHOTO_RESULT && resultCode == RESULT_OK ) {
        AppCompatImageView imageView = findViewById(R.id.imageView);
        imageView.setImageBitmap(BitmapFactory.decodeFile(mLastPhotoURI.getPath()));
    }
}
 
Example #29
Source File: SlideFragment.java    From Android-9-Development-Cookbook with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_slide, container, false);
    AppCompatImageView imageView = rootView.findViewById(R.id.imageView);
    imageView.setImageResource(mImageResourceID);
    return rootView;
}
 
Example #30
Source File: MainActivity.java    From Android-9-Development-Cookbook with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

     AppCompatImageView imageView = findViewById(R.id.imageViewThumbnail);
     imageView.setImageBitmap(
             loadSampledResource(R.drawable.miguel_henriques_789508_unsplash, 100, 100));
}