當前位置: 首頁>>代碼示例>>Java>>正文


Java CompoundButton.getId方法代碼示例

本文整理匯總了Java中android.widget.CompoundButton.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java CompoundButton.getId方法的具體用法?Java CompoundButton.getId怎麽用?Java CompoundButton.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.CompoundButton的用法示例。


在下文中一共展示了CompoundButton.getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
public void onCheckedChanged(CompoundButton buttonView,
                             boolean isChecked) {
    // prevents from infinite recursion
    if (mProtectFromCheckedChange) {
        return;
    }

    mProtectFromCheckedChange = true;
    if (mCheckedId != -1) {
        setCheckedStateForView(mCheckedId, false);
    }
    mProtectFromCheckedChange = false;

    int id = buttonView.getId();
    setCheckedId(id);
}
 
開發者ID:ZouJianFeng-Marco,項目名稱:Navigation-bar,代碼行數:17,代碼來源:FlowRadioGroup.java

示例2: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

    if (isChecked) {

        switch (buttonView.getId()) {
            case R.id.red_color_rb:
                mBinding.testQueuedProgressbar.setBallColor(Color.RED);
                break;
            case R.id.green_color_rb:
                mBinding.testQueuedProgressbar.setBallColor(Color.GREEN);
                break;
            case R.id.blue_color_rb:
                mBinding.testQueuedProgressbar.setBallColor(Color.BLUE);
                break;
            default:
                mBinding.testQueuedProgressbar.setBallColor(0);
                break;
        }
    }
}
 
開發者ID:trdevendran,項目名稱:queued-progressbar,代碼行數:22,代碼來源:MainActivity.java

示例3: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    switch (compoundButton.getId()) {
        case R.id.cb_setting_night:
            if (isNull) {   //防止夜間模式MainActivity執行reCreate後重複調用
                SharedPreferenceUtil.setNightModeState(b);
                NightModeEvent event = new NightModeEvent();
                event.setNightMode(b);
                RxBus.getDefault().post(event);
            }
            break;
        case R.id.cb_setting_image:
            SharedPreferenceUtil.setNoImageState(b);
            break;
        case R.id.cb_setting_cache:
            SharedPreferenceUtil.setAutoCacheState(b);
            break;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:SettingFragment.java

示例4: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
	if(buttonView.getId() == R.id.use_username) {
		if(isChecked) {
			usernameLayout.setVisibility(View.VISIBLE);
			passwordLayout.setVisibility(View.VISIBLE);
			phoneNumberEdit.setVisibility(EditText.GONE);
			phoneNumberLayout.setVisibility(LinearLayout.GONE);
			messagePhoneNumber.setText(getString(R.string.assistant_linphone_login_desc));
			recoverAccount = false;
		} else {
			usernameLayout.setVisibility(View.GONE);
			passwordLayout.setVisibility(View.GONE);
			phoneNumberEdit.setVisibility(EditText.VISIBLE);
			phoneNumberLayout.setVisibility(LinearLayout.VISIBLE);
			messagePhoneNumber.setText(getString(R.string.assistant_create_account_part_1));
			recoverAccount = true;
		}
	}
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:21,代碼來源:LinphoneLoginFragment.java

示例5: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
	switch (buttonView.getId()) {
	case R.id.fragment_update_tree_details_missing_tree:
		mTreeIsMissing = isChecked;
		EditText noteTxt = (EditText) getActivity().findViewById(R.id.fragment_update_tree_details_note);
		
		if (isChecked) {
			noteTxt.setHint(getActivity().getResources().getString(R.string.cause_of_death));
		} else {
			noteTxt.setHint(getActivity().getResources().getString(R.string.your_note));
		}
		break;

	default:
		break;
	}
	
}
 
開發者ID:Greenstand,項目名稱:treetracker-android,代碼行數:19,代碼來源:UpdateTreeDetailsFragment.java

示例6: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    Log.i("AlarmFrcheckListener", "buttonView=" + buttonView);
    if (isChecked) {
        confirmable = true;
        if (buttonView.getId() == map[0]) {
            checkedOnce(true);
        } else {
            checkedOnce(false);
        }
    } else {
        for (int id : map) {
            if (((AppCompatCheckBox) findViewById(id)).isChecked()) {
                confirmable = true;
                break;
            }
            confirmable = false;
        }
    }
    mTvConfirm.setTextColor(confirmable ? context.getResources().getColor(R.color.base_blue)
            : context.getResources().getColor(R.color.forbid_click_color));
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:23,代碼來源:AlarmFrDialog.java

示例7: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@OnCheckedChanged({R.id.cb_setting_cache, R.id.cb_setting_image, R.id.cb_setting_night})
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
    if (!mIsInited)
        return;

    switch (view.getId()) {
        case R.id.cb_setting_cache:
            mPresenter.setArticleAutoCacheState(isChecked);
            break;
        case R.id.cb_setting_image:
            mPresenter.setArticleNoImageState(isChecked);
            break;
        case R.id.cb_setting_night:
            if (mIsBundleNull) {
                mPresenter.setNightModeState(isChecked);
                NightModeEvent event = new NightModeEvent();
                event.setNightMode(isChecked);
                EventBus.getDefault().post(event);
            }
            break;
    }
}
 
開發者ID:HanyeeWang,項目名稱:GeekZone,代碼行數:23,代碼來源:SettingFragment.java

示例8: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    switch(buttonView.getId()) {
        case toggle_midview :
            if(isChecked)
                recyclerViewMidterm.setVisibility(View.VISIBLE);
            else
                recyclerViewMidterm.setVisibility(View.GONE);
            break;
        case toggle_finview :
            if (isChecked)
                recyclerViewFinals.setVisibility(View.VISIBLE);
            else
                recyclerViewFinals.setVisibility(View.GONE);
            break;
    }
}
 
開發者ID:inteliedoit,項目名稱:thesis-project,代碼行數:18,代碼來源:SubjectViewActivity.java

示例9: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    setChecking();
    compoundButton.setChecked(true);

    switch (compoundButton.getId()){
        case R.id.radioButton1:
            builder.setType(TextCounter.BYTE);
            seekBar1.setEnabled(false);
            type = TextCounter.BYTE;
            break;
        case R.id.radioButton2:
            builder.setType(TextCounter.SHORT);
            seekBar1.setEnabled(false);
            type = TextCounter.SHORT;
            break;
        case R.id.radioButton3:
            builder.setType(TextCounter.INT);
            seekBar1.setEnabled(false);
            type = TextCounter.INT;
            break;
        case R.id.radioButton4:
            builder.setType(TextCounter.FLOAT);
            seekBar1.setEnabled(true);
            type = TextCounter.FLOAT;
            break;
        case R.id.radioButton5:
            builder.setType(TextCounter.LONG);
            seekBar1.setEnabled(false);
            type = TextCounter.LONG;
            break;
        case R.id.radioButton6:
            builder.setType(TextCounter.DOUBLE);
            seekBar1.setEnabled(true);
            type = TextCounter.DOUBLE;
            break;
        default:
            return;
    }
}
 
開發者ID:BullyBoo,項目名稱:TextCounter,代碼行數:41,代碼來源:MainActivity.java

示例10: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
    switch (compoundButton.getId()) {
        case R.id.toggle_calculator: {
            setAppEnabled(PACKAGE_NAME_CALCULATOR, checked);
            mCalculatorEnabled = checked;
            break;
        }
        case R.id.toggle_chrome: {
            setAppEnabled(PACKAGE_NAME_CHROME, checked);
            mChromeEnabled = checked;
            break;
        }
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:16,代碼來源:BasicManagedProfileFragment.java

示例11: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//        FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
//        BaseFragment fragment = ((BaseFragment) buttonView.getTag());
//        if (isChecked) {
//            fragmentTransaction.show(fragment);
//        } else {
//            fragmentTransaction.hide(fragment);
//        }
//        fragmentTransaction.commit();
        switch (buttonView.getId()) {
            case R.id.cbMessage:
                handleFragment(fragments.get(0), isChecked);
                break;
            case R.id.cbReceive:
                handleFragment(fragments.get(1), isChecked);
                break;
            case R.id.cbDiliver:
                handleFragment(fragments.get(2), isChecked);
                break;
            case R.id.cbOffice:
                handleFragment(fragments.get(3), isChecked);
                break;
            case R.id.cbMe:
                handleFragment(fragments.get(4), isChecked);
                break;
        }
    }
 
開發者ID:NaOHAndroid,項目名稱:Logistics-guard,代碼行數:29,代碼來源:TabView.java

示例12: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.getId() == cbVolume.getId()) {
        SettingManager.getInstance().saveVolumeFlipEnable(isChecked);
    } else if (buttonView.getId() == cbAutoBrightness.getId()) {
        if (isChecked) {
            startAutoLightness();
        } else {
            stopAutoLightness();
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ReadActivity.java

示例13: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.getId() == R.id.switchMessage) {
        // 消息通知
        SettingsUtil.updateMessageNotification(isChecked);
        if (isChecked) {
            if (!BaseSettings.sNotifyEnable) {
                // 啟用消息通知
                UnreadService.startService();
                enableNotifyInterval();
            }
        } else {
            if (!mSwitchPrivateLetter.isChecked() && BaseSettings.sNotifyEnable) {
                // 停止消息通知
                UnreadService.stopService();
                disableNotifyInterval();
            }
        }
    } else if (buttonView.getId() == R.id.switchPrivateLetter) {
        // 私信通知
        SettingsUtil.updatePrivateLetterNotification(isChecked);
        if (isChecked) {
            if (!BaseSettings.sNotifyEnable) {
                // 啟用消息通知
                UnreadService.startService();
                enableNotifyInterval();
            }
        } else {
            if (!mSwitchMessage.isChecked() && BaseSettings.sNotifyEnable) {
                // 停止消息通知
                UnreadService.stopService();
                disableNotifyInterval();
            }
        }
    }
}
 
開發者ID:liying2008,項目名稱:Simpler,代碼行數:37,代碼來源:NotificationSettingsActivity.java

示例14: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (mProtectFromCheckedChange) {
        return;
    }
    mProtectFromCheckedChange = true;
    if (mCheckedId != -1) {
        setCheckedStateForView(mCheckedId, false);
    }
    mProtectFromCheckedChange = false;

    int id = buttonView.getId();
    setCheckedId(id);
}
 
開發者ID:JackWHLiu,項目名稱:jackknife,代碼行數:14,代碼來源:MultiRadioGroup.java

示例15: onCheckedChanged

import android.widget.CompoundButton; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
    switch (compoundButton.getId()) {
        case R.id.toolbar_switch:
            isToolbarVisible = checked;
            break;
        case R.id.drawer_switch:
            isDrawerEnabled = checked;
            break;
        default:
            break;
    }

    getFlowr().syncScreenState();
}
 
開發者ID:Fueled,項目名稱:flowr,代碼行數:16,代碼來源:ViewFragment.java


注:本文中的android.widget.CompoundButton.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。