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


Java SwitchCompat.isChecked方法代碼示例

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


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

示例1: onSharedPreferenceChanged

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("log".equals(name)) {
        // Get enabled
        boolean log = prefs.getBoolean(name, false);

        // Display disabled warning
        TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
        tvDisabled.setVisibility(log ? View.GONE : View.VISIBLE);

        // Check switch state
        SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
        if (swEnabled.isChecked() != log)
            swEnabled.setChecked(log);

        ServiceSinkhole.reload("changed " + name, ActivityLog.this);
    }
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:20,代碼來源:ActivityLog.java

示例2: onSideSwitch

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
public void onSideSwitch(SwitchCompat v) {
    Rect rect = new Rect();
    v.getGlobalVisibleRect(rect);
    final int cy = rect.centerY();
    final int halfThumbWidth = v.getThumbDrawable().getIntrinsicWidth() / 2;
    final int cx;

    if (this instanceof DayModeFragment && v.isChecked()) {
        cx = rect.right - halfThumbWidth;
        mThemeActivity.switchModeFragment(cx, cy, isAppBarExpanded(), NightModeFragment.TAG);
    } else if (!v.isChecked()) {
        cx = rect.left + halfThumbWidth;
        mThemeActivity.switchModeFragment(cx, cy, isAppBarExpanded(), DayModeFragment.TAG);
    }
}
 
開發者ID:woxingxiao,項目名稱:GracefulMovies,代碼行數:16,代碼來源:SideFragment.java

示例3: isPersistSwitchOn

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
/**
 * Returns true if the persist switch exists and is toggled on.
 */
@CalledByNative
protected boolean isPersistSwitchOn() {
    SwitchCompat persistSwitch = (SwitchCompat) getView().findViewById(
            R.id.permission_infobar_persist_toggle);
    if (mShowPersistenceToggle && persistSwitch != null) {
        return persistSwitch.isChecked();
    }
    return false;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:13,代碼來源:PermissionInfoBar.java

示例4: saveProject

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Override
public void saveProject(EditText project_name, SwitchCompat is_archived) {
    if (is_archived.isChecked()) {
        project.setState(1);
    } else {
        project.setState(0);
    }

    project.setName(project_name.getText().toString());

    project.save();
}
 
開發者ID:The-LoneWolf,項目名稱:Project-Assistant,代碼行數:13,代碼來源:ProjectDetailActivityPresenter.java

示例5: onSharedPreferenceChanged

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("enabled".equals(name)) {
        // Get enabled
        boolean enabled = prefs.getBoolean(name, false);

        // Check switch state
        SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
        if (swEnabled.isChecked() != enabled)
            swEnabled.setChecked(enabled);
    }
}
 
開發者ID:shivam141296,項目名稱:Android-Firewall,代碼行數:14,代碼來源:ActivityMain.java

示例6: userDesiresSend

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Nullable
@Override
public TCMPMessage userDesiresSend(View parameterViewParent) {
    SwitchCompat continuousSwitch = ButterKnife.findById(parameterViewParent,R.id.sw_continuous);
    SeekBar seekBar = ButterKnife.findById(parameterViewParent,R.id.seeker_polling_time);

    boolean isContinuous = continuousSwitch.isChecked();
    int timeValue = seekBar.getProgress() + 1;
    timeValue = timeValue == 11 ? 0: timeValue;


    return command.getMessage((byte)timeValue,isContinuous);
}
 
開發者ID:TapTrack,項目名稱:TappyBLE,代碼行數:14,代碼來源:ScanCommandAdapter.java

示例7: onSharedPreferenceChanged

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("enabled".equals(name)) {
        // Get enabled
        boolean enabled = prefs.getBoolean(name, false);

        // Display disabled warning
        TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
        tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);

        // Check switch state
        SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
        if (swEnabled.isChecked() != enabled)
            swEnabled.setChecked(enabled);

    } else if ("whitelist_wifi".equals(name) ||
            "screen_on".equals(name) ||
            "screen_wifi".equals(name) ||
            "whitelist_other".equals(name) ||
            "screen_other".equals(name) ||
            "whitelist_roaming".equals(name) ||
            "show_user".equals(name) ||
            "show_system".equals(name) ||
            "show_nointernet".equals(name) ||
            "show_disabled".equals(name) ||
            "sort".equals(name) ||
            "imported".equals(name)) {
        updateApplicationList(null);

        final LinearLayout llWhitelist = (LinearLayout) findViewById(R.id.llWhitelist);
        boolean screen_on = prefs.getBoolean("screen_on", true);
        boolean whitelist_wifi = prefs.getBoolean("whitelist_wifi", false);
        boolean whitelist_other = prefs.getBoolean("whitelist_other", false);
        boolean hintWhitelist = prefs.getBoolean("hint_whitelist", true);
        llWhitelist.setVisibility(!(whitelist_wifi || whitelist_other) && screen_on && hintWhitelist ? View.VISIBLE : View.GONE);

    } else if ("manage_system".equals(name)) {
        invalidateOptionsMenu();
        updateApplicationList(null);

        LinearLayout llSystem = (LinearLayout) findViewById(R.id.llSystem);
        boolean system = prefs.getBoolean("manage_system", false);
        boolean hint = prefs.getBoolean("hint_system", true);
        llSystem.setVisibility(!system && hint ? View.VISIBLE : View.GONE);

    } else if ("theme".equals(name) || "dark_theme".equals(name))
        recreate();
}
 
開發者ID:miankai,項目名稱:MKAPP,代碼行數:50,代碼來源:ActivityMain.java

示例8: onSharedPreferenceChanged

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("enabled".equals(name)) {
        // Get enabled
        boolean enabled = prefs.getBoolean(name, false);

        // Display disabled warning
        TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
        tvDisabled.setVisibility(enabled ? View.GONE : View.VISIBLE);

        // Check switch state
        SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
        if (swEnabled.isChecked() != enabled)
            swEnabled.setChecked(enabled);

    } else if ("whitelist_wifi".equals(name) ||
            "screen_wifi".equals(name) ||
            "whitelist_other".equals(name) ||
            "screen_other".equals(name) ||
            "whitelist_roaming".equals(name) ||
            "show_user".equals(name) ||
            "show_system".equals(name) ||
            "show_nointernet".equals(name) ||
            "show_disabled".equals(name) ||
            "sort".equals(name) ||
            "imported".equals(name)) {
        updateApplicationList(null);

        final LinearLayout llWhitelist = (LinearLayout) findViewById(R.id.llWhitelist);
        boolean whitelist_wifi = prefs.getBoolean("whitelist_wifi", false);
        boolean whitelist_other = prefs.getBoolean("whitelist_other", false);
        boolean hintWhitelist = prefs.getBoolean("hint_whitelist", true);
        llWhitelist.setVisibility(!(whitelist_wifi || whitelist_other) && hintWhitelist ? View.VISIBLE : View.GONE);

    } else if ("manage_system".equals(name)) {
        invalidateOptionsMenu();
        updateApplicationList(null);

        LinearLayout llSystem = (LinearLayout) findViewById(R.id.llSystem);
        boolean system = prefs.getBoolean("manage_system", false);
        boolean hint = prefs.getBoolean("hint_system", true);
        llSystem.setVisibility(!system && hint ? View.VISIBLE : View.GONE);

    } else if ("theme".equals(name) || "dark_theme".equals(name))
        recreate();
}
 
開發者ID:Romascu,項目名稱:NoRootFirewall-Custom,代碼行數:48,代碼來源:ActivityMain.java

示例9: uncheckSwitchIfChecked

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
private void uncheckSwitchIfChecked(SwitchCompat switchCompat) {
    if (switchCompat.isChecked()) {
        switchCompat.setChecked(false);
    }
}
 
開發者ID:Popdeem,項目名稱:Popdeem-SDK-Android,代碼行數:6,代碼來源:PDUIClaimActivity.java

示例10: getStatus

import android.support.v7.widget.SwitchCompat; //導入方法依賴的package包/類
/**
 * Tells us whether or not the switch says the light is currently on or not.
 *
 * @param buttonSwitch the switch we want to check the status on
 * @return ON if the switch is currently on, OFF otherwise
 */
@VisibleForTesting
protected Executor.LoadStatus getStatus(SwitchCompat buttonSwitch) {
    return buttonSwitch.isChecked() ? Executor.LoadStatus.ON : Executor.LoadStatus.OFF;
}
 
開發者ID:sourceallies,項目名稱:zonebeacon,代碼行數:11,代碼來源:MainAdapter.java


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