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

The following are Jave code examples for showing how to use setClickable() 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: NanoIconPackLite   File: LiteIconActivity.java   View Source Code Vote up 7 votes
private View initIconView() {
    FrameLayout contentView = new FrameLayout(LiteIconActivity.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivity.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return contentView;
}
 
Example 2
Project: KeylineMaterialDesign   File: KeylineDrawService.java   View Source Code Vote up 7 votes
public void draw() {

        windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        Display deviceDisplay = windowManager.getDefaultDisplay();
        Point point = new Point();
        deviceDisplay.getSize(point);
        deviceWidth = point.x;
        deviceHeight = point.y;

        imageView = new ImageView(this);
        imageView.setClickable(false);
        imageView.setFocusable(false);
        imageView.setMinimumHeight(deviceHeight);
        imageView.setMinimumWidth(deviceWidth);

        drawKeylines();

    }
 
Example 3
Project: KUtils-master   File: BGABannerUtil.java   View Source Code Vote up 6 votes
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) {
    ImageView imageView = new ImageView(context);
    imageView.setImageResource(placeholderResId);
    imageView.setClickable(true);
    imageView.setScaleType(scaleType);
    return imageView;
}
 
Example 4
Project: Bigbang   File: ColorPickerView.java   View Source Code Vote up 6 votes
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
Example 5
Project: NanoIconPackLite   File: LiteIconActivityV1.java   View Source Code Vote up 6 votes
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    FrameLayout contentView = new FrameLayout(LiteIconActivityV1.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivityV1.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return new IconHolder(contentView);
}
 
Example 6
Project: NanoIconPackLite   File: LiteIconActivityV2.java   View Source Code Vote up 6 votes
private View initIconView() {
    FrameLayout contentView = new FrameLayout(LiteIconActivityV2.this);
    int gridW = (int) (displayMetrics.density * GRID_W_IN_DP);
    int gridH = (int) (displayMetrics.density * GRID_H_IN_DP);
    ViewGroup.LayoutParams lpCv = new ViewGroup.LayoutParams(gridW, gridH);
    contentView.setLayoutParams(lpCv);

    ImageView ivIcon = new ImageView(LiteIconActivityV2.this);
    ivIcon.setTag("iv");
    ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
    ivIcon.setClickable(true);
    ivIcon.setBackgroundResource(getClickBg());
    int iconSize = (int) (displayMetrics.density * ICON_SIZE_IN_DP);
    FrameLayout.LayoutParams lpIv = new FrameLayout.LayoutParams(iconSize, iconSize);
    lpIv.gravity = Gravity.CENTER;
    ivIcon.setLayoutParams(lpIv);
    contentView.addView(ivIcon);

    return contentView;
}
 
Example 7
Project: cordova-plugin-image-picker   File: ImageFetcher.java   View Source Code Vote up 6 votes
private void setInvisible() {
    // Log.d("COLLAGE", "Setting something invisible...");
    if (imageViewReference != null) {
        final ImageView imageView = imageViewReference.get();
        BitmapFetcherTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
        if (this == bitmapDownloaderTask) {
            imageView.setVisibility(View.GONE);
            imageView.setClickable(false);
            imageView.setEnabled(false);
        }
    }
}
 
Example 8
Project: anitrend-app   File: ProfileActivity.java   View Source Code Vote up 6 votes
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_user_profile, menu);
    notification_item = (ImageView) menu.findItem(R.id.action_notification).getActionView();
    messages_item = (ImageView) menu.findItem(R.id.action_message).getActionView();
    activity_post = (ImageView) menu.findItem(R.id.action_status_post).getActionView();

    if(mCurrentUser != null) {
        menu.findItem(R.id.action_notification).setVisible(true);
        menu.findItem(R.id.action_message).setVisible(true);
        menu.findItem(R.id.action_status_post).setVisible(true);


        notification_item.setImageDrawable(mCurrentUser.getNotifications() > 0?
                             ContextCompat.getDrawable(this, R.drawable.ic_notifications_active_white_24dp):
                             ContextCompat.getDrawable(this, R.drawable.ic_notifications_none_white_24dp)
                    );
        notification_item.setPadding(0,0,20,0);

        messages_item.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_mail_outline_white_24dp));
        messages_item.setPadding(25,0,30,0);

        activity_post.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_chat_bubble_outline_white_24dp));
        activity_post.setPadding(25,0,15,0);

        notification_item.setClickable(true);
        activity_post.setClickable(true);
        messages_item.setClickable(true);

        notification_item.setOnClickListener(this);
        messages_item.setOnClickListener(this);
        activity_post.setOnClickListener(this);

        showTutorial();
    }
    return true;
}
 
Example 9
Project: Brevent   File: DonateTask.java   View Source Code Vote up 6 votes
@Override
protected void onProgressUpdate(DonateActivity.DonateItem... values) {
    if (mReference.get() != null) {
        DonateActivity.DonateItem item = values[0];
        ImageView donate = item.imageView;
        donate.setContentDescription(item.label);
        donate.setImageDrawable(item.icon);
        donate.setClickable(true);
        donate.setVisibility(View.VISIBLE);
    }
}
 
Example 10
Project: MenuSet   File: MainContentFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    mImageView = (ImageView) rootView.findViewById(R.id.image_content);
    mImageView.setClickable(true);
    mImageView.setFocusable(true);
    mImageView.setImageResource(res);
    return rootView;
}
 
Example 11
Project: NeiHanDuanZiTV   File: BGABannerUtil.java   View Source Code Vote up 6 votes
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) {
    ImageView imageView = new ImageView(context);
    imageView.setImageResource(placeholderResId);
    imageView.setClickable(true);
    imageView.setScaleType(scaleType);
    return imageView;
}
 
Example 12
Project: Quran   File: TranslationsAdapter.java   View Source Code Vote up 5 votes
@Override
public void onBindViewHolder(TranslationViewHolder holder, int position) {
  TranslationRowData rowItem = translations.get(position);
  switch (holder.getItemViewType()) {
    case R.layout.translation_row:
      TranslationItem item = (TranslationItem) rowItem;
      holder.getTranslationTitle().setText(item.name());
      if (TextUtils.isEmpty(item.translation.translatorNameLocalized)) {
        holder.getTranslationInfo().setText(item.translation.translator);
      } else {
        holder.getTranslationInfo().setText(item.translation.translatorNameLocalized);
      }

      ImageView leftImage = holder.getLeftImage();
      ImageView rightImage = holder.getRightImage();

      if (item.exists()) {
        if (item.needsUpgrade()) {
          leftImage.setImageResource(R.drawable.ic_download);
          leftImage.setVisibility(View.VISIBLE);
          holder.getTranslationInfo().setText(R.string.update_available);
        } else {
          leftImage.setVisibility(View.GONE);
        }
        rightImage.setImageResource(R.drawable.ic_cancel);
        rightImage.setVisibility(View.VISIBLE);
        rightImage.setContentDescription(context.getString(R.string.remove_button));
      } else {
        leftImage.setVisibility(View.GONE);
        rightImage.setImageResource(R.drawable.ic_download);
        rightImage.setVisibility(View.VISIBLE);
        rightImage.setOnClickListener(null);
        rightImage.setClickable(false);
        rightImage.setContentDescription(null);
      }
      break;
    case R.layout.translation_sep:
      holder.getSeparatorText().setText(rowItem.name());
      break;
  }
}
 
Example 13
Project: JD-Test   File: BGABannerUtil.java   View Source Code Vote up 5 votes
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) {
    ImageView imageView = new ImageView(context);
    imageView.setImageResource(placeholderResId);
    imageView.setClickable(true);
    imageView.setScaleType(scaleType);
    return imageView;
}
 
Example 14
Project: MyEyepetizer   File: HomeCollectionItemBinder.java   View Source Code Vote up 5 votes
public ViewHold(View itemView) {
    super(itemView);
    image = (ImageView) itemView.findViewById(R.id.home_item_image);
    image.setClickable(false);
    title = (TextView) itemView.findViewById(R.id.collection_item_title);
    info = (TextView) itemView.findViewById(R.id.collection_item_info);
}
 
Example 15
Project: chromium-for-android-56-debug-video   File: ToolbarPhone.java   View Source Code Vote up 5 votes
private void inflateTabSwitchingResources() {
    mToggleTabStackButton = (ImageView) findViewById(R.id.tab_switcher_button);
    mNewTabButton = (NewTabButton) findViewById(R.id.new_tab_button);

    mToggleTabStackButton.setClickable(false);
    Resources resources = getResources();
    mTabSwitcherButtonDrawable =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, false);
    mTabSwitcherButtonDrawableLight =
            TabSwitcherDrawable.createTabSwitcherDrawable(resources, true);
    mToggleTabStackButton.setImageDrawable(mTabSwitcherButtonDrawable);
    mTabSwitcherModeViews.add(mNewTabButton);

    // Ensure that the new tab button will not draw over the toolbar buttons if the
    // translated string is long.  Set a margin to the size of the toolbar button container
    // for the new tab button.
    WindowManager wm = (WindowManager) getContext().getSystemService(
            Context.WINDOW_SERVICE);
    Point screenSize = new Point();
    wm.getDefaultDisplay().getSize(screenSize);

    mToolbarButtonsContainer.measure(
            MeasureSpec.makeMeasureSpec(screenSize.x, MeasureSpec.AT_MOST),
            MeasureSpec.makeMeasureSpec(screenSize.y, MeasureSpec.AT_MOST));

    ApiCompatibilityUtils.setMarginEnd(getFrameLayoutParams(mNewTabButton),
            mToolbarButtonsContainer.getMeasuredWidth());
}
 
Example 16
Project: Bowling-Scoring   File: MainActivity.java   View Source Code Vote up 5 votes
private void gameEnd() {
    //disable submit button
    ImageView image = findViewById(R.id.submit);
    image.setClickable(false);

    //disable pin +/- buttons
    ImageView image2 = findViewById(R.id.minus);
    image2.setClickable(false);
    ImageView image3 = findViewById(R.id.plus);
    image3.setClickable(false);

    //hide active player icon
    activePlayer1.setVisibility(activePlayer1.INVISIBLE);
    activePlayer2.setVisibility(activePlayer2.INVISIBLE);

    // use pin selection ImageView to display winner
    if (tScorePlayer1 > tScorePlayer2) {
        Drawable player1Win = getResources().getDrawable(R.drawable.playeronewin);
        imageViewDownedPins.setImageDrawable(player1Win);
    } else if (tScorePlayer2 > tScorePlayer1) {
        Drawable player2Win = getResources().getDrawable(R.drawable.playertwowin);
        imageViewDownedPins.setImageDrawable(player2Win);
    } else {
        Drawable draw = getResources().getDrawable(R.drawable.draw);
        imageViewDownedPins.setImageDrawable(draw);
    }
}
 
Example 17
Project: Bowling-Scoring   File: MainActivity.java   View Source Code Vote up 5 votes
public void resetGame(View v) {

        // reset all scores and active player icon
        frameScoresPlayer1 = new int[22];
        frameScoresPlayer2 = new int[22];
        frameTotalScoresPlayer1 = new int[11];
        frameTotalScoresPlayer2 = new int[11];
        tScorePlayer1 = 0;
        tScorePlayer2 = 0;
        activePlayer = 2;
        updateScores();
        activePlayer();
        updateScores();

        // reset relevant variables
        downedPinsPointer = -1;
        frameNumber = 1;
        frameEnd = false;
        extraScore = false;
        maxPins = 10;

        // set number of pins ImageView to the instructions
        Drawable instructions = getResources().getDrawable(R.drawable.instructions);
        imageViewDownedPins.setImageDrawable(instructions);

        //reset submit button
        ImageView image = findViewById(R.id.submit);
        image.setClickable(true);

        //reset pin +/- buttons
        ImageView image2 = findViewById(R.id.minus);
        image2.setClickable(true);
        ImageView image3 = findViewById(R.id.plus);
        image3.setClickable(true);
    }
 
Example 18
Project: javaide   File: ColorPickerView.java   View Source Code Vote up 5 votes
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
Example 19
Project: CXJPadProject   File: MessageHolderBase.java   View Source Code Vote up 5 votes
/**
 * 显示重新发送dialog
 * @param msgStatus
 * @param reSendListener
 */
public static void showReSendDialog(Context context,final ImageView msgStatus,final ReSendListener reSendListener ){
    int width = context.getResources().getDisplayMetrics().widthPixels;
    int widths = 0;
    if (width == 480) {
        widths = 80;
    } else {
        widths = 120;
    }
    final ReSendDialog reSendDialog = new ReSendDialog(context);
    reSendDialog.setOnClickListener(new ReSendDialog.OnItemClick() {
        @Override
        public void OnClick(int type) {
            if (type == 0) {// 0:确定 1:取消
                reSendListener.onReSend();
            }
            reSendDialog.dismiss();
        }
    });
    reSendDialog.show();
    msgStatus.setClickable(true);
    WindowManager windowManager = ((Activity)context).getWindowManager();
    Display display = windowManager.getDefaultDisplay();
    if(reSendDialog.getWindow()!= null){
        WindowManager.LayoutParams lp = reSendDialog.getWindow().getAttributes();
        lp.width = (int) (display.getWidth() - widths); // 设置宽度
        reSendDialog.getWindow().setAttributes(lp);
    }
}
 
Example 20
Project: SuperNote   File: RvEditFolderAdapter.java   View Source Code Vote up 5 votes
private void setFirstItemOrNormal(BaseViewHolder helper){

        ImageView ivRename=helper.getView(R.id.iv_edit_folder_rename);
        CheckBox checkBox=helper.getView(R.id.cb_edit_folder);
        RelativeLayout rlRoot=helper.getView(R.id.rl_edit_folder);

        // 第一行(随手记)不可编辑
        if(helper.getLayoutPosition()==0){

            checkBox.setAlpha(0.26F);
            rlRoot.setClickable(false);

        } else {

            ivRename.setAlpha(0.54F);
            ivRename.setClickable(true);

            checkBox.setAlpha(0.87F);
            rlRoot.setClickable(true);

        }
    }