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

The following are Jave code examples for showing how to use getId() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ArcLayout-master   File: MainActivity.java   View Source Code Vote up 6 votes
private void showToast(ImageView btn) {
    if (toast != null) {
        toast.cancel();
    }
    String text = "Clicked: " + btn.getId();
    toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
    toast.show();

}
 
Example 2
Project: AcademApp   File: ChooseTypeActivity.java   View Source Code Vote up 6 votes
@OnLongClick({R.id.student, R.id.lecturer})
boolean onLongClick(ImageView imageView) {
    switch (imageView.getId()) {
        case R.id.student:
            Toast.makeText(this, "Student", Toast.LENGTH_SHORT).show();
            break;
        case R.id.lecturer:
            Toast.makeText(this, "Lecturer", Toast.LENGTH_SHORT).show();
            break;
    }
    return true;
}
 
Example 3
Project: AcademApp   File: ChooseTypeActivity.java   View Source Code Vote up 6 votes
@OnClick({R.id.student, R.id.lecturer})
void onClick(ImageView imageView) {
    switch (imageView.getId()) {
        case R.id.student:

            if (studentTickImage.getVisibility() != View.VISIBLE) {
                chosenType = 0;
                studentTickImage.setVisibility(View.VISIBLE);
                MaterialIn.animate(studentTickImage, Gravity.TOP, Gravity.TOP);

                lecturerTickImage.setVisibility(View.INVISIBLE);
                animateButton("Student");
            }
            break;
        case R.id.lecturer:
            // chosen lecturer
            if (lecturerTickImage.getVisibility() != View.VISIBLE) {
                chosenType = 1;
                studentTickImage.setVisibility(View.INVISIBLE);

                lecturerTickImage.setVisibility(View.VISIBLE);
                MaterialIn.animate(lecturerTickImage, Gravity.TOP, Gravity.TOP);

                animateButton("Lecturer");
            }
            break;
    }
}
 
Example 4
Project: Android-2017   File: CallLogAdapter.java   View Source Code Vote up 5 votes
@Override
public void setViewImage(ImageView view, String value) {
    if (view.getId() == R.id.liCallIcon) {
        switch (Integer.parseInt (value)) {
            case Calls.INCOMING_TYPE :
                view.setImageResource(R.drawable.ic_recived);
                break;
            case Calls.OUTGOING_TYPE :
                view.setImageResource(R.drawable.ic_made);
                break;
            case Calls.MISSED_TYPE :
                view.setImageResource(R.drawable.ic_missed);
                break;
            case Calls.REJECTED_TYPE :
                view.setImageResource(R.drawable.ic_rejected);
                break;
        }
        Log.d("APPTEST", value);
    }
}
 
Example 5
Project: LoginConcept   File: LoginActivity.java   View Source Code Vote up 5 votes
@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);
                    });
                }
            });
}