当前位置: 首页>>代码示例>>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;未经允许,请勿转载。