Java Code Examples for android.widget.ImageButton#setClickable()

The following examples show how to use android.widget.ImageButton#setClickable() . 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: ChromaDoze.java    From chromadoze with GNU General Public License v3.0 6 votes vote down vote up
public void setFragmentId(int id) {
    mFragmentId = id;

    final boolean enableUp = id != FragmentIndex.ID_CHROMA_DOZE;
    ActionBar actionBar = getSupportActionBar();
    supportInvalidateOptionsMenu();

    // Use the default left arrow, or a scaled-down Chroma Doze icon.
    actionBar.setHomeAsUpIndicator(enableUp ? null : mToolbarIcon);

    // When we're on the main page, make the icon non-clickable.
    ImageButton navUp = findImageButton(findViewById(R.id.toolbar));
    if (navUp != null) {
        navUp.setClickable(enableUp);
    }

    mNavSpinner.setSelection(id);
}
 
Example 2
Source File: ChatActivity.java    From CoolChat with Apache License 2.0 5 votes vote down vote up
private void initViews() {
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    LinearLayoutManager layoutManager = new LinearLayoutManager(ChatActivity.this);
    //layoutManager.setStackFromEnd(true);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new ChatAdapter(ChatActivity.this, chatListData);
    recyclerView.setAdapter(adapter);
    edit_input = (EditText) findViewById(R.id.edit_input);
    edit_input.addTextChangedListener(textWatcher);
    edit_input.setOnClickListener(this);
    text_unread_msg = (TextView) findViewById(R.id.text_unread_msg);

    layout_multi = (LinearLayout) findViewById(R.id.layout_multi);
    imgbtn_send = (ImageButton) findViewById(R.id.imgbtn_send);
    imgbtn_send.setClickable(false);

    checkbox_audio = (CheckBox) findViewById(R.id.checkbox_audio);
    checkbox_emoji = (CheckBox) findViewById(R.id.checkbox_emoji);
    checkbox_gallery = (CheckBox) findViewById(R.id.checkbox_gallery);
    checkbox_video = (CheckBox) findViewById(R.id.checkbox_video);
    checkbox_more = (CheckBox) findViewById(R.id.checkbox_more);

    checkbox_audio.setOnCheckedChangeListener(this);
    checkbox_emoji.setOnCheckedChangeListener(this);
    checkbox_video.setOnCheckedChangeListener(this);
    checkbox_gallery.setOnCheckedChangeListener(this);
    checkbox_more.setOnCheckedChangeListener(this);

    text_unread_msg.setOnClickListener(this);
    imgbtn_send.setOnClickListener(this);

    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            initMoreChatData(chatType, chatId);
        }
    });
}
 
Example 3
Source File: MonthFragmentAdapter.java    From Birdays with Apache License 2.0 5 votes vote down vote up
private void enableButton(ImageButton button) {
    if (nightMode()) {
        button.setColorFilter(Color.rgb(104, 239, 173));
    } else {
        button.setColorFilter(Color.rgb(33, 150, 243));
    }
    button.setClickable(true);
}
 
Example 4
Source File: MonthFragmentAdapter.java    From Birdays with Apache License 2.0 5 votes vote down vote up
private void disableButton(ImageButton button) {
    if (nightMode()) {
        button.setColorFilter(Color.rgb(112, 112, 112));
    } else {
        button.setColorFilter(Color.rgb(224, 224, 224));
    }
    button.setClickable(false);
}
 
Example 5
Source File: MeCarController.java    From Makeblock-App-For-Android with MIT License 5 votes vote down vote up
public void setDisable(){
	mLeftUpButton = (ImageButton)view.findViewById(R.id.leftUpButton);
	mRightUpButton = (ImageButton)view.findViewById(R.id.rightUpButton);
	mLeftDownButton = (ImageButton)view.findViewById(R.id.leftDownButton);
	mRightDownButton = (ImageButton)view.findViewById(R.id.rightDownButton);
	mLeftButton = (ImageButton)view.findViewById(R.id.leftButton);
	mRightButton = (ImageButton)view.findViewById(R.id.rightButton);
	mUpButton = (ImageButton)view.findViewById(R.id.upButton);
	mDownButton = (ImageButton)view.findViewById(R.id.downButton);
	mSpeedButton = (ImageButton)view.findViewById(R.id.speedButton);
	mLeftUpButton.setOnClickListener(null);
	mRightUpButton.setOnClickListener(null);
	mLeftDownButton.setOnClickListener(null);
	mRightDownButton.setOnClickListener(null);
	mLeftButton.setOnClickListener(null);
	mRightButton.setOnClickListener(null);
	mUpButton.setOnClickListener(null);
	mDownButton.setOnClickListener(null);
	mSpeedButton.setOnClickListener(null);
	mLeftUpButton.setClickable(false);
	mRightUpButton.setClickable(false);
	mLeftDownButton.setClickable(false);
	mRightDownButton.setClickable(false);
	mLeftUpButton.setEnabled(false);
	mRightUpButton.setEnabled(false);
	mLeftDownButton.setEnabled(false);
	mRightDownButton.setEnabled(false);
	mLeftButton.setClickable(false);
	mRightButton.setClickable(false);
	mUpButton.setClickable(false);
	mDownButton.setClickable(false);
	mLeftButton.setEnabled(false);
	mRightButton.setEnabled(false);
	mUpButton.setEnabled(false);
	mDownButton.setEnabled(false);
	mSpeedButton.setClickable(false);
	mSpeedButton.setEnabled(false);
}
 
Example 6
Source File: MeGripper.java    From Makeblock-App-For-Android with MIT License 5 votes vote down vote up
public void setDisable(){
	mLeftButton = (ImageButton)view.findViewById(R.id.leftButton);
	mRightButton = (ImageButton)view.findViewById(R.id.rightButton);
	mSpeedButton = (ImageButton)view.findViewById(R.id.speedButton);
    mSpeedLabel = (TextView)view.findViewById(R.id.speedLabel);
    mPortLabel = (TextView)view.findViewById(R.id.textPort);
	mLeftButton.setClickable(false);
	mRightButton.setClickable(false);
	mLeftButton.setEnabled(false);
	mRightButton.setEnabled(false);
	mSpeedButton.setClickable(false);
	mSpeedButton.setEnabled(false);
    mSpeedLabel.setText("Speed:"+motorSpeed);
    mPortLabel.setText((port>8?("M"+(port-8)):("PORT "+port)));
}
 
Example 7
Source File: ZenMenuAdapter.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
		View convertView, ViewGroup parent) {
	Map<String, String> map = (Map<String, String>)mHeaders.get(groupPosition);
	String text = (String)map.get("name");
	if(convertView == null) {
		convertView = mInflater.inflate(R.layout.zen_menu_group, null);			
	}
	ImageButton itemLeft = (ImageButton)convertView.findViewById(R.id.zen_menu_header_left);
	Button itemRight = (Button)convertView.findViewById(R.id.zen_menu_header_right);
	itemRight.setText(text);
	
	itemLeft.setImageResource(R.drawable.menu_right_arrow);
	if(isExpanded) {
		itemLeft.setImageResource(R.drawable.menu_down_arrow);
	}
	
	int background = menu_item_backgrounds[groupPosition%9];
	itemLeft.setBackgroundResource(background);
	itemRight.setBackgroundResource(background);
	itemLeft.setFocusable(false);
	itemRight.setFocusable(false);
	itemLeft.setClickable(false);
	itemRight.setClickable(false);
	
	
	
	return convertView;
}
 
Example 8
Source File: MenuItemView.java    From SpringFloatingActionMenu with Apache License 2.0 4 votes vote down vote up
private void init(Context context) {

        Resources resources = getResources();
        int diameterPX = Utils.dpToPx(mMenuItem.getDiameter(), resources);
        this.mDiameter = diameterPX;
        mBtn = new ImageButton(context);
        LayoutParams btnLp = new LayoutParams(diameterPX, diameterPX);
        btnLp.gravity = Gravity.CENTER_HORIZONTAL;
        btnLp.bottomMargin = Util.dpToPx(mGapSize, resources);
        mBtn.setLayoutParams(btnLp);
        OvalShape ovalShape = new OvalShape();
        ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
        shapeDrawable.getPaint().setColor(resources.getColor(mMenuItem.getBgColor()));
        mBtn.setBackgroundDrawable(shapeDrawable);
        mBtn.setImageResource(mMenuItem.getIcon());
        mBtn.setClickable(false);
        addView(mBtn);

        mLabel = new TextView(context);
        LayoutParams labelLp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        labelLp.gravity = Gravity.CENTER_HORIZONTAL;
        mLabel.setLayoutParams(labelLp);
        mLabel.setText(mMenuItem.getLabel());
        mLabel.setTextColor(resources.getColor(mMenuItem.getTextColor()));
        mLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize);
        addView(mLabel);

        setOrientation(LinearLayout.VERTICAL);
        if(mAlphaAnimation) {
            setAlpha(0);
        }

        getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
                applyPressAnimation();
                ViewGroup parent = (ViewGroup) getParent();
                parent.setClipChildren(false);
                parent.setClipToPadding(false);
                setClipChildren(false);
                setClipToPadding(false);
            }
        });


    }
 
Example 9
Source File: FullScreenVideoViewFragment.java    From CameraV with GNU General Public License v3.0 3 votes vote down vote up
@SuppressWarnings("deprecation")
	@Override
	protected void initLayout() {
		super.initLayout();
	
		mediaHolder_ = LayoutInflater.from(getActivity()).inflate(R.layout.editors_video, null);

		videoView = (VideoView) mediaHolder_.findViewById(R.id.video_view);

	//	LayoutParams vv_lp = videoView.getLayoutParams();
//		vv_lp.width = dims[0];
//		vv_lp.height = (int) (((float) media_.dcimEntry.exif.height) / ((float) media_.dcimEntry.exif.width) * dims[0]);

	//	videoView.setLayoutParams(vv_lp);
		videoView.setOnTouchListener(this);

		mediaHolder.addView(mediaHolder_);
		
		surfaceHolder = videoView.getHolder();
		
		//Log.d(LOG, "surface holder dims: " + surfaceHolder.getSurfaceFrame().width() + " x " + surfaceHolder.getSurfaceFrame().height());
		surfaceHolder.addCallback(this);
		
		if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
			surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
		
		//Log.d(LOG, "video view dims: " + videoView.getWidth() + " x " + videoView.getHeight());
		
		videoControlsHolder = (LinearLayout) mediaHolder_.findViewById(R.id.video_controls_holder);		

		videoSeekBar = (VideoSeekBar) mediaHolder_.findViewById(R.id.video_seek_bar);
		endpointHolder = (LinearLayout) mediaHolder_.findViewById(R.id.video_seek_bar_endpoint_holder);
		
		playPauseToggle = (ImageButton) mediaHolder_.findViewById(R.id.video_play_pause_toggle);
		playPauseToggle.setOnClickListener(this);
		playPauseToggle.setClickable(false);		
		
		
	}