Java Code Examples for android.widget.ImageView#getId()

The following examples show how to use android.widget.ImageView#getId() . 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: PuzzleActivity.java    From EasyPhotos with Apache License 2.0 5 votes vote down vote up
private void toggleIvMenu(@IdRes int resId) {
    for (ImageView ivMenu : ivMenus) {
        if (ivMenu.getId() == resId) {
            ivMenu.setColorFilter(ContextCompat.getColor(this, R.color.easy_photos_fg_accent));
        } else {
            ivMenu.clearColorFilter();
        }
    }

}
 
Example 2
Source File: WraperDetailViewpagerAdapter.java    From wallpaper with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
	// TODO Auto-generated method stub
	if (null != mListener) {
		ImageView imageView = (ImageView) view;
		int index = imageView.getId() - OFFSET_IMAGE_VIEW;
		mListener.viewpagerItemDidClicked(index);
	} else {
		Log.i("kyson", "please set listener with method:setViewPagerItemClickListener");
	}
}
 
Example 3
Source File: WraperDetailViewpagerAdapter.java    From wallpaper with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
	// TODO Auto-generated method stub
	if (null != mListener) {
		ImageView imageView = (ImageView) view;
		int index = imageView.getId() - OFFSET_IMAGE_VIEW;
		mListener.viewpagerItemDidClicked(index);
	} else {
		Log.i("kyson", "please set listener with method:setViewPagerItemClickListener");
	}
}
 
Example 4
Source File: PuzzleActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void toggleIvMenu(@IdRes int resId) {
    for (ImageView ivMenu : ivMenus) {
        if (ivMenu.getId() == resId) {
            ivMenu.setColorFilter(ContextCompat.getColor(this, R.color.easy_photos_fg_accent));
        } else {
            ivMenu.clearColorFilter();
        }
    }

}
 
Example 5
Source File: SlideChartView.java    From SlidePager with MIT License 5 votes vote down vote up
/**
 * Init the {@link android.graphics.Color} of the {@link #mChartBarList}
 */
private void initBarColorsAndSize() {
    for (ImageView imageView : mChartBarList) {
        imageView.setBackgroundColor(mChartBarColor);
        if (imageView.getId() != R.id.progress_bottom_axis) {
            imageView.setMinimumHeight((int) (mChartBarSize / 2.0f));
        }
    }
}
 
Example 6
Source File: LoginActivity.java    From android-login with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_login);
  ButterKnife.bind(this);
  final AnimatedViewPager pager = ButterKnife.findById(this, R.id.pager);
  final ImageView background = ButterKnife.findById(this, R.id.scrolling_background);
  int[] screenSize = screenSize();

  for (ImageView element : sharedElements) {
    @ColorRes int color = element.getId() != R.id.logo ? R.color.white_transparent : R.color.color_logo_log_in;
    DrawableCompat.setTint(element.getDrawable(), ContextCompat.getColor(this, color));
  }
  //load a very big image and resize it, so it fits our needs
  Glide.with(this)
          .load(R.drawable.busy)
          .asBitmap()
          .override(screenSize[0] * 2, screenSize[1])
          .diskCacheStrategy(DiskCacheStrategy.RESULT)
          .into(new ImageViewTarget<Bitmap>(background) {
            @Override
            protected void setResource(Bitmap resource) {
              background.setImageBitmap(resource);
              background.post(() -> {
                //we need to scroll to the very left edge of the image
                //fire the scale animation
                background.scrollTo(-background.getWidth() / 2, 0);
                ObjectAnimator xAnimator = ObjectAnimator.ofFloat(background, View.SCALE_X, 4f, background.getScaleX());
                ObjectAnimator yAnimator = ObjectAnimator.ofFloat(background, View.SCALE_Y, 4f, background.getScaleY());
                AnimatorSet set = new AnimatorSet();
                set.playTogether(xAnimator, yAnimator);
                set.setDuration(getResources().getInteger(R.integer.duration));
                set.start();
              });
              pager.post(() -> {
                AuthAdapter adapter = new AuthAdapter(getSupportFragmentManager(), pager, background, sharedElements);
                pager.setAdapter(adapter);
              });
            }
          });
}