android.widget.Button#setClickable ( )源码实例Demo

下面列出了android.widget.Button#setClickable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: StandupTimer.java
protected synchronized void disableIndividualTimer() {
    Logger.d("Disabling the individual timer");

    remainingIndividualSeconds = 0;

    TextView participantNumber = (TextView) findViewById(R.id.participant_number);
    participantNumber.setText("individual_status_complete");

    TextView individualTimeRemaining = (TextView) findViewById(R.id.individual_time_remaining);
    individualTimeRemaining.setText(TimeFormatHelper.formatTime(remainingIndividualSeconds));
    individualTimeRemaining.setTextColor(Color.GRAY);

    Button nextButton = (Button) findViewById(R.id.next_button);
    nextButton.setClickable(false);
    nextButton.setTextColor(Color.GRAY);
}
 
源代码2 项目: privacy-friendly-dame   文件: MainActivity.java
@Override
protected void onStart() {
    super.onStart();
    currentGame = loadFile();
    Button game_continue = findViewById(R.id.continueButton);
    if (currentGame == null || currentGame.isGameFinished())
    {
        // no saved game available
        game_continuable = false;
        game_continue.setClickable(true);
        game_continue.setBackgroundResource(R.drawable.button_disabled);
    }
    else
    {
        game_continuable = true;
        game_continue.setClickable(true);
        game_continue.setBackgroundResource(R.drawable.standalone_button);
    }
}
 
源代码3 项目: DragonGoApp   文件: GoJsActivity.java
void initFinished() {
	System.out.println("init finished");
	writeInLabel("init done. You can play !");
	final Button button1 = (Button)findViewById(R.id.but1);
	button1.setClickable(true);
	button1.setEnabled(true);
	final Button button2 = (Button)findViewById(R.id.but2);
	button2.setClickable(true);
	button2.setEnabled(true);
	final Button button3 = (Button)findViewById(R.id.but3);
	button3.setClickable(true);
	button3.setEnabled(true);
	button1.invalidate();
	button2.invalidate();
	button3.invalidate();
}
 
源代码4 项目: privacy-friendly-ludo   文件: MainActivity.java
@Override
protected void onRestart() {
    super.onRestart();
    model = loadFile();
    Button game_continue = (Button) findViewById(R.id.game_button_continue);
    if (model == null || model.isGame_finished())
    {
        // no saved game available
        game_continuable = false;
        game_continue.setClickable(true);
        game_continue.setBackgroundColor(ContextCompat.getColor(getBaseContext(),(R.color.middlegrey)));
    }
    else
    {
        game_continuable = true;
        game_continue.setClickable(true);
        game_continue.setBackgroundColor(ContextCompat.getColor(getBaseContext(),R.color.colorPrimary));
    }
}
 
源代码5 项目: Adafruit_Android_BLE_UART   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Grab references to UI elements.
    messages = (TextView) findViewById(R.id.messages);
    input = (EditText) findViewById(R.id.input);

    // Initialize UART.
    uart = new BluetoothLeUart(getApplicationContext());

    // Disable the send button until we're connected.
    send = (Button)findViewById(R.id.send);
    send.setClickable(false);
    send.setEnabled(false);

    // Enable auto-scroll in the TextView
    messages.setMovementMethod(new ScrollingMovementMethod());
}
 
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
	finish();	
	}
});
}
 
源代码7 项目: UltimateAndroid   文件: StandupTimer.java
protected synchronized void disableIndividualTimer() {
    Logger.d("Disabling the individual timer");

    remainingIndividualSeconds = 0;

    TextView participantNumber = (TextView) findViewById(R.id.participant_number);
    participantNumber.setText("individual_status_complete");

    TextView individualTimeRemaining = (TextView) findViewById(R.id.individual_time_remaining);
    individualTimeRemaining.setText(TimeFormatHelper.formatTime(remainingIndividualSeconds));
    individualTimeRemaining.setTextColor(Color.GRAY);

    Button nextButton = (Button) findViewById(R.id.next_button);
    nextButton.setClickable(false);
    nextButton.setTextColor(Color.GRAY);
}
 
源代码8 项目: commcare-android   文件: PaneledChoiceDialog.java
public static void populateChoicePanel(Context context, Button choicePanel,
                                       DialogChoiceItem item, boolean iconToLeft) {
    choicePanel.setText(item.text);
    if (item.listener != null) {
        choicePanel.setOnClickListener(item.listener);
    } else {
        // needed to propagate clicks down to the ListView's ItemClickListener
        choicePanel.setFocusable(false);
        choicePanel.setClickable(false);
    }
    if (item.iconResId != -1) {
        Drawable icon = ContextCompat.getDrawable(context, item.iconResId);
        if (iconToLeft) {
            if (LocalePreferences.isLocaleRTL())
                choicePanel.setCompoundDrawablesWithIntrinsicBounds(null, null, icon, null);
            else
                choicePanel.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
        } else {
            choicePanel.setCompoundDrawablesWithIntrinsicBounds(null, icon, null, null);
        }
    }
}
 
源代码9 项目: weMessage   文件: ProgressDialogLayout.java
public void showButton(){
    Button actionButton = findViewById(R.id.progressDialogButton);
    LinearLayout buttonContainer = findViewById(R.id.progressDialogButtonContainer);

    actionButton.setClickable(true);
    actionButton.setVisibility(View.VISIBLE);
    buttonContainer.setVisibility(View.VISIBLE);
}
 
源代码10 项目: sealrtc-android   文件: VerifyActivity.java
private void initView() {
    btn_login = (Button) findViewById(R.id.btn_login);
    reg_getcode = (Button) findViewById(R.id.reg_getcode);
    btn_login.setOnClickListener(onClickListener);
    btn_login.setClickable(false);

    reg_getcode.setOnClickListener(onClickListener);
    edit_phone = (EditText) findViewById(R.id.edit_phone);
    String phone = SessionManager.getInstance().getString(UserUtils.PHONE);
    if (!TextUtils.isEmpty(phone)) {
        edit_phone.setText(phone);
        reg_getcode.setClickable(true);
        reg_getcode.setBackgroundDrawable(
            getResources().getDrawable(R.drawable.rs_select_btn_blue));
    }
    tv_tips = (TextView) findViewById(R.id.tv_tips);
    edit_verificationCode = (EditText) findViewById(R.id.edit_verificationCode);
    versionCodeView = (TextView) findViewById(R.id.main_page_version_code);
    versionCodeView.setText(
        getResources().getString(R.string.blink_description_version)
            + BuildConfig.VERSION_NAME
            + (BuildConfig.DEBUG ? "_Debug" : ""));
    versionCodeView.setTextColor(getResources().getColor(R.color.blink_text_green));
    mTvRegion = (TextView) findViewById(R.id.tv_region);
    mTvCountry = (TextView) findViewById(R.id.tv_country);
    mTvCountry.setOnClickListener(onClickListener);
    updateCountry();
    img_logo = (ImageView) findViewById(R.id.img_logo);
    if (img_logo != null) {
        if (ServerUtils.usePrivateCloud()) {
            img_logo.setImageResource(R.drawable.ic_launcher_privatecloud);
        } else {
            img_logo.setImageResource(R.drawable.ic_launcher);
        }
    }
}
 
源代码11 项目: letv   文件: MyDownloadingFragment.java
private void setButtonStatus(Button button, boolean canClick) {
    Logger.d(TAG, " setButtonStatus canClick : " + canClick);
    if (canClick) {
        button.setClickable(true);
        button.setBackgroundResource(R.drawable.btn_blue_selecter);
        button.setTextAppearance(this.mContext, R.style.letv_text_13_blue_white);
        return;
    }
    button.setClickable(false);
    button.setBackgroundResource(R.drawable.btn_grey);
    button.setTextColor(Util.getContext().getResources().getColor(R.color.letv_color_ffa1a1a1));
}
 
源代码12 项目: Virtual-Hosts   文件: VhostsActivity.java
private void setButton(boolean enable) {
    final SwitchButton vpnButton = (SwitchButton) findViewById(R.id.button_start_vpn);
    final Button selectHosts = (Button) findViewById(R.id.button_select_hosts);
    if (enable) {
        vpnButton.setChecked(false);
        selectHosts.setAlpha(1.0f);
        selectHosts.setClickable(true);
    } else {
        vpnButton.setChecked(true);
        selectHosts.setAlpha(.5f);
        selectHosts.setClickable(false);
    }
}
 
源代码13 项目: DMusic   文件: NewListDialog.java
@Override
protected void init(View rootView) {
    etName = (EditText) rootView.findViewById(R.id.et_name);
    btnOk = (Button) rootView.findViewById(R.id.btn_ok);
    btnCancel = (Button) rootView.findViewById(R.id.btn_cancel);
    btnOk.setClickable(false);
    btnOk.setOnClickListener(this);
    btnCancel.setOnClickListener(this);
    etName.addTextChangedListener(this);
}
 
源代码14 项目: zen4android   文件: ZenMenuAdapter.java
@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;
}
 
源代码15 项目: BigApp_Discuz_Android   文件: AsyncTaskExtend.java
@Override
protected void onPostExecute(Object result) {

    ZogUtils.printLog(AsyncTaskExtend.class, "onPostExecute");

    for (Button b : btns) {
        b.setClickable(true);
    }
    for (LinearLayout ll : linearLayouts) {
        ll.setClickable(true);
    }
}
 
源代码16 项目: sealtalk-android   文件: RegisterActivity.java
private void initView() {
    mPhoneEdit = (ClearWriteEditText) findViewById(R.id.reg_phone);
    mCodeEdit = (ClearWriteEditText) findViewById(R.id.reg_code);
    mNickEdit = (ClearWriteEditText) findViewById(R.id.reg_username);
    mPasswordEdit = (ClearWriteEditText) findViewById(R.id.reg_password);
    mGetCode = (Button) findViewById(R.id.reg_getcode);
    mConfirm = (Button) findViewById(R.id.reg_button);

    mGetCode.setOnClickListener(this);
    mGetCode.setClickable(false);
    mConfirm.setOnClickListener(this);

    goLogin = (TextView) findViewById(R.id.reg_login);
    goForget = (TextView) findViewById(R.id.reg_forget);
    goLogin.setOnClickListener(this);
    goForget.setOnClickListener(this);

    mImgBackgroud = (ImageView) findViewById(R.id.rg_img_backgroud);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Animation animation = AnimationUtils.loadAnimation(RegisterActivity.this, R.anim.translate_anim);
            mImgBackgroud.startAnimation(animation);
        }
    }, 200);

    addEditTextListener();

}
 
源代码17 项目: green_android   文件: CircularButton.java
public CircularButton(Context context, AttributeSet attrs) {
    super(context, attrs);

    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CircularButton);

    setLayoutTransition(new LayoutTransition());

    setRadius(getPx(DEFAULT_RADIUS));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setElevation(getPx(DEFAULT_ELEVATION));
    }

    mLinearLayout = new LinearLayout(context);
    mLinearLayout.setOrientation(LinearLayout.VERTICAL);

    // set selectable background
    final TypedValue typedValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                                             typedValue, true);
    mSelectableItemBackground = typedValue.resourceId;
    mLinearLayout.setBackgroundResource(mSelectableItemBackground);

    // create button
    mButton = new Button(context);
    mButton.setBackgroundColor(Color.TRANSPARENT);
    mButton.setClickable(false);
    mButton.setPadding((int)getPx(15), mButton.getPaddingTop(), (int)getPx(15),
                       mButton.getPaddingBottom());
    final String text = typedArray.getString(R.styleable.CircularButton_text);
    mButton.setText(text);
    mButton.setTextColor(typedArray.getColor(R.styleable.CircularButton_textColor, Color.BLACK));

    // create progressbar
    mProgressBar = new ProgressBar(context);
    mProgressBar.setVisibility(View.GONE);

    // animation transaction
    final LayoutTransition layoutTransition = getLayoutTransition();
    layoutTransition.setDuration(DEFAULT_DURATION);
    layoutTransition.enableTransitionType(LayoutTransition.CHANGING);

    this.setOnClickListener(view -> {
        if (isClickable()) {
            startLoading();
        }
    });

    // set background color animations
    mBackgroundColor = typedArray.getColorStateList(R.styleable.CardView_cardBackgroundColor)
                       .getDefaultColor();
    final ColorDrawable[] color1 = {new ColorDrawable(mBackgroundColor),
                                    new ColorDrawable(Color.WHITE)};
    mTransStartLoading = new TransitionDrawable(color1);
    final ColorDrawable[] color2 = {new ColorDrawable(mSelectableItemBackground), new
                                    ColorDrawable(mBackgroundColor)};
    mTransStopLoading = new TransitionDrawable(color2);

    // set progressbar for API < lollipop
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        mProgressBar.setBackgroundColor(Color.WHITE);
        mProgressBar.getIndeterminateDrawable().setColorFilter(
            mBackgroundColor, PorterDuff.Mode.SRC_IN);
    }

    typedArray.recycle();

    // get the width set
    final int[] width = new int[] { android.R.attr.layout_width };
    final TypedArray typedArray1 = context.obtainStyledAttributes(attrs, width);
    mLayoutWidth = typedArray1.getLayoutDimension(0, ViewGroup.LayoutParams.WRAP_CONTENT);
    typedArray1.recycle();

    mLinearLayout.addView(mButton);
    mLinearLayout.addView(mProgressBar);
    addView(mLinearLayout);
}
 
源代码18 项目: Pharmacy-Android   文件: OrderDetailFragment.java
private void disableButton(Button button) {
    button.setClickable(false);
    button.setAlpha(0.5f);
}
 
源代码19 项目: Mobike   文件: LoginActivity.java
/**
 * 改变bt颜色red设置可点击
 *
 * @param bt
 */
private void setButtonRed(Button bt) {
    bt.setClickable(true);
    bt.setBackgroundResource(R.color.red);
}
 
源代码20 项目: Mobike   文件: LoginActivity.java
/**
 * 改变bt颜色gray设置不可点击
 *
 * @param bt
 */
private void setButtonGray(Button bt) {
    bt.setClickable(false);
    bt.setBackgroundResource(R.color.gray);
}