Java 类android.support.v7.widget.SwitchCompat 实例源码

项目:GitHub    文件:ImageFormatKeyframesFragment.java   
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setOldController(mSimpleDraweeView.getController())
      .setUri(URI_KEYFRAMES_ANIMATION)
      .setAutoPlayAnimations(true)
      .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked
          ? new CheckerBoardDrawable(getResources())
          : null);
    }
  });
}
项目:TrackIt-Android    文件:ShowSettingsActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_show_settings);

    showID = getIntent().getIntExtra("showID", 0);
    notificationSwitch = (SwitchCompat) findViewById(R.id.notification_switch);
    updateImagesSwitch = (SwitchCompat) findViewById(R.id.update_images_switch);
    posterTV = (TextView) findViewById(R.id.tv_poster);
    bannerTV = (TextView) findViewById(R.id.tv_banner);
    fanArtTV = (TextView) findViewById(R.id.tv_fanart);
    updateImagesLayout = (RelativeLayout) findViewById(R.id.update_images);
    notificationTimeLayout = (LinearLayout) findViewById(R.id.notification_time);
    notificationTimeTV = (TextView) findViewById(R.id.tv_notification_time);

    notificationViewPopulate();
    notificationSwitchListener();
    imagesSwitchListener();
    viewListeners();
}
项目:mobile-store    文件:StartSwapView.java   
private void uiInitBluetooth() {
    if (bluetooth != null) {

        textBluetoothVisible = (TextView) findViewById(R.id.bluetooth_visible);

        viewBluetoothId = (TextView) findViewById(R.id.device_id_bluetooth);
        viewBluetoothId.setText(bluetooth.getName());
        viewBluetoothId.setVisibility(bluetooth.isEnabled() ? View.VISIBLE : View.GONE);

        int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth;
        textBluetoothVisible.setText(textResource);

        bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth);
        Utils.debugLog(TAG, getManager().isBluetoothDiscoverable() ? "Initially marking switch as checked, because Bluetooth is discoverable." : "Initially marking switch as not-checked, because Bluetooth is not discoverable.");
        bluetoothSwitch.setOnCheckedChangeListener(onBluetoothSwitchToggled);
        setBluetoothSwitchState(getManager().isBluetoothDiscoverable(), true);

        LocalBroadcastManager.getInstance(getContext()).registerReceiver(onBluetoothSwapStateChanged, new IntentFilter(SwapService.BLUETOOTH_STATE_CHANGE));

    } else {
        findViewById(R.id.bluetooth_info).setVisibility(View.GONE);
    }
}
项目:AutoOff    文件:Settings_Activity.java   
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SwitchCompat switchshutdowncountdown = (SwitchCompat) findViewById(R.id.switchshutdowncountdown);

    if (requestCode == REQUEST_CODE) {
        if (android.provider.Settings.canDrawOverlays(Settings_Activity.this)) {
            // continue here - permission was granted
            settingsprefs.edit().putBoolean("sysOverlay", true).apply();
            switchshutdowncountdown.setChecked(true);
        } else {
            settingsprefs.edit().putBoolean("sysOverlay", false).apply();
            switchshutdowncountdown.setChecked(false);
        }
    } else if (requestCode == REQUEST_CODE_ENABLE) {
        settingsprefs.edit().putBoolean("pinprotection", true).apply();
        changepin.setVisibility(View.VISIBLE);
        changepindivider.setVisibility(View.VISIBLE);
    }
}
项目:TestChat    文件:SettingsActivity.java   
@Override
public void initView() {
        headerLayout = (RelativeLayout) findViewById(R.id.rl_setting_header);
        account = (TextView) findViewById(R.id.tv_setting_account);
        nick = (TextView) findViewById(R.id.tv_tv_setting_nick);
        avatar = (RoundAngleImageView) findViewById(R.id.riv_setting_avatar);
        RelativeLayout notificationLayout = (RelativeLayout) findViewById(R.id.rl_setting_notification);
        ((TextView) notificationLayout.findViewById(R.id.tv_setting_item_title)).setText("通知提醒");
        notification = (SwitchCompat) findViewById(R.id.switch_setting_item_check);
        clear = (LinearLayout) findViewById(R.id.ll_setting_clear);
        ((TextView) clear.findViewById(R.id.tv_group_info_item_layout_title)).setText("清空所有的聊天记录");
        chatFlow = (TextView) clear.findViewById(R.id.tv_group_info_item_layout_value);
        logout = (Button) findViewById(R.id.btn_setting_logout);
        headerLayout.setOnClickListener(this);
        clear.setOnClickListener(this);
        logout.setOnClickListener(this);
        notification.setOnCheckedChangeListener(this);
}
项目:MiPushFramework    文件:MainActivity.java   
@Override
public boolean onCreateOptionsMenu (Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem item = menu.findItem(R.id.action_enable);
    item.setActionView(R.layout.switch_layout);
    SwitchCompat mSwitchEnablePush = item.getActionView().findViewById(R.id.switchForActionBar);
    mSwitchEnablePush.setChecked(PushController.isAllEnable(this));
    mSwitchEnablePush.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            PushController.setAllEnable(b, MainActivity.this);
            Toast.makeText(MainActivity.this,
                    b ? R.string.msg_enable : R.string.msg_disable
                    , Toast.LENGTH_SHORT).show();
        }
    });
    return true;
}
项目:MKAPP    文件:ActivityLog.java   
@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);
    }
}
项目:MTweaks-KernelAdiutorMOD    文件:ProfileFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_apply_on_boot, container, false);

    ((TextView) rootView.findViewById(R.id.title)).setText(getString(R.string.profile_tasker_toast));
    SwitchCompat switchCompat = (SwitchCompat) rootView.findViewById(R.id.switcher);
    switchCompat.setChecked(Prefs.getBoolean("showtaskertoast", true, getActivity()));
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            Prefs.saveBoolean("showtaskertoast", b, getActivity());
        }
    });

    return rootView;
}
项目:chromium-for-android-56-debug-video    文件:TranslateInfoBar.java   
@Override
public void onOptionsChanged() {
    if (mNativeTranslateInfoBarPtr == 0) return;

    // Handle the "Always Translate" checkbox.
    if (getInfoBarType() == AFTER_TRANSLATE_INFOBAR) {
        SwitchCompat alwaysSwitch = (SwitchCompat) getView().findViewById(
                R.id.translate_infobar_always_toggle);
        mOptions.toggleAlwaysTranslateLanguageState(alwaysSwitch.isChecked());
    }

    if (mOptions.optionsChanged()) {
        nativeApplyTranslateOptions(mNativeTranslateInfoBarPtr, mOptions.sourceLanguageCode(),
                mOptions.targetLanguageCode(), mOptions.alwaysTranslateLanguageState(),
                mOptions.neverTranslateLanguageState(), mOptions.neverTranslateDomainState());
    }
}
项目:FastEc    文件:ListAdapter.java   
@Override
protected void convert(BaseViewHolder helper, ListBean item) {
    switch (helper.getItemViewType()) {
        case ListItemType.ITEM_NORMAL:
            helper.setText(R.id.tv_arrow_text, item.getText());
            helper.setText(R.id.tv_arrow_value, item.getValue());
            break;

        case ListItemType.ITEM_AVATAR:
            Glide.with(mContext)
                    .load(item.getImageUrl())
                    .diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop().dontAnimate()
                    .into((ImageView) helper.getView(R.id.img_arrow_avatar));

            break;
        case ListItemType.ITEM_SWITCH:
            helper.setText(R.id.tv_arrow_switch_text,item.getText());
            final SwitchCompat switchCompat = helper.getView(R.id.list_item_switch);
            switchCompat.setChecked(true);
            switchCompat.setOnCheckedChangeListener(item.getOnCheckedChangeListener());
            break;

    }
}
项目:KernelAdiutor-Mod    文件:ProfileFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_apply_on_boot, container, false);

    ((TextView) rootView.findViewById(R.id.title)).setText(getString(R.string.profile_tasker_toast));
    SwitchCompat switchCompat = (SwitchCompat) rootView.findViewById(R.id.switcher);
    switchCompat.setChecked(Prefs.getBoolean("showtaskertoast", true, getActivity()));
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            Prefs.saveBoolean("showtaskertoast", b, getActivity());
        }
    });

    return rootView;
}
项目:iSPY    文件:TrackerActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_switch, menu);

    // Get the action view used in your toggleservice item
    final MenuItem toggle = menu.findItem(R.id.menu_switch);
    mSwitch = (SwitchCompat) toggle.getActionView().findViewById(R.id.switchInActionBar);
    mSwitch.setEnabled(mTransportIdEditText.length() > 0 && mEmailEditText.length() > 0 &&
            mPasswordEditText.length() > 0);
    mSwitch.setChecked(mStartButton.getVisibility() != View.VISIBLE);
    mSwitch.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (((SwitchCompat) v).isChecked()) {
                checkInputFields();
            } else {
                confirmStop();
            }
        }
    });
    return super.onCreateOptionsMenu(menu);
}
项目:TitleBarView    文件:MainActivity.java   
@Override
protected void initView(Bundle bundle) {
    super.initView(bundle);
    GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead);
    titleBarDrawer.setImmersible(mContext, isImmersible, isLight);
    vHeader = View.inflate(mContext, R.layout.layout_title_header, null);
    sBtnImmersible = (SwitchCompat) vHeader.findViewById(R.id.sBtn_immersible);
    sBtnLight = (SwitchCompat) vHeader.findViewById(R.id.sBtn_light);
    sBtnLine = (SwitchCompat) vHeader.findViewById(R.id.sBtn_line);
    lLayoutAlpha = (LinearLayout) vHeader.findViewById(R.id.lLayout_alpha);
    sBarAlpha = (SeekBar) vHeader.findViewById(R.id.sBar_alpha);
    tvStatusAlpha = (TextView) vHeader.findViewById(R.id.tv_statusAlpha);
    initView();
    setDrawerList();
    initData();
}
项目:UIWidget    文件:TitleActivity.java   
@Override
    protected void initView(Bundle bundle) {
        super.initView(bundle);

//        drawerRoot.setScrimColor(0x00ffffff);//背景高亮
//        drawerRoot.setDrawerElevation(40);//海拔高度
        mContentView.setBackgroundDrawable(null);
        GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead);
        titleBarDrawer.setImmersible(mContext, isImmersible, isLight);
        vHeader = View.inflate(mContext, R.layout.layout_title_header, null);
        sBtnImmersible = (SwitchCompat) vHeader.findViewById(R.id.sBtn_immersible);
        sBtnLight = (SwitchCompat) vHeader.findViewById(R.id.sBtn_light);
        sBtnLine = (SwitchCompat) vHeader.findViewById(R.id.sBtn_line);
        lLayoutAlpha = (LinearLayout) vHeader.findViewById(R.id.lLayout_alpha);
        sBarAlpha = (SeekBar) vHeader.findViewById(R.id.sBar_alpha);
        tvStatusAlpha = (TextView) vHeader.findViewById(R.id.tv_statusAlpha);
        initView();
        setDrawerList();
        initData();
    }
项目:CS4160-trustchain-android    文件:TrustChainActivity.java   
private void initVariables() {
    thisActivity = this;
    localIPText = findViewById(R.id.my_local_ip);
    externalIPText = findViewById(R.id.my_external_ip);
    statusText = findViewById(R.id.status);
    statusText.setMovementMethod(new ScrollingMovementMethod());

    sendButton = (Button) findViewById(R.id.send_button);
    messageEditText = (EditText) findViewById(R.id.message_edit_text);
    extraInformationPanel = (LinearLayout) findViewById(R.id.extra_information_panel);
    developerModeText = (TextView) findViewById(R.id.developer_mode_text);
    switchDeveloperMode = (SwitchCompat) findViewById(R.id.switch_developer_mode);
    switchDeveloperMode.setOnCheckedChangeListener(this);

    editTextDestinationIP = findViewById(R.id.destination_IP);
    editTextDestinationPort = findViewById(R.id.destination_port);
}
项目:ttnmapper_android_v2    文件:MapsActivity.java   
public void restartLogging() {
    Log.d(TAG, "Restarting mapping");

    stopLoggingService();

    MyApplication mApplication = (MyApplication) getApplicationContext();
    if (mApplication.isConfigured()) {
        Log.d(TAG, "Starting mapping");
        startLoggingService();
        setStatusMessage("Mapping restarted.");
    } else {
        setStatusMessage("You need to link a device before you can start mapping!");
        SwitchCompat toggleButton = (SwitchCompat) findViewById(R.id.switchStartLogging);
        toggleButton.setChecked(false);
    }
}
项目:SwipeRecyclerView    文件:DefineActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View header = getLayoutInflater().inflate(R.layout.layout_header_switch, mRecyclerView, false);
    mRecyclerView.addHeaderView(header);

    SwitchCompat switchCompat = (SwitchCompat) header.findViewById(R.id.switch_compat);
    switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // 控制是否可以侧滑删除。
            mRecyclerView.setItemViewSwipeEnabled(isChecked);
        }
    });

    mRecyclerView.setLongPressDragEnabled(true); // 长按拖拽,默认关闭。
    mRecyclerView.setItemViewSwipeEnabled(true); // 滑动删除,默认关闭。

    // 自定义拖拽控制参数。
    mRecyclerView.setOnItemMovementListener(mItemMovementListener);
}
项目:ssj    文件:AnnotationTab.java   
/**
 * @param id    int
 * @param value boolean
 * @return boolean
 */
public boolean toggleAnnoButton(int id, final boolean value)
{
    if (annoClassList == null || activity == null || !running)
    {
        return false;
    }
    final LinearLayout anno = (LinearLayout) annoClassList.getChildAt(id);
    if (anno == null)
    {
        return false;
    }
    activity.runOnUiThread(new Runnable()
    {
        @Override
        public void run()
        {
            SwitchCompat button = (SwitchCompat) ((LinearLayout)anno.getChildAt(1)).getChildAt(0);
            if (button.isEnabled())
                button.setChecked(value);
        }
    });
    return true;
}
项目:AutoOff    文件:Settings_Activity.java   
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SwitchCompat switchshutdowncountdown = (SwitchCompat) findViewById(R.id.switchshutdowncountdown);

    if (requestCode == REQUEST_CODE) {
        if (android.provider.Settings.canDrawOverlays(Settings_Activity.this)) {
            // continue here - permission was granted
            settingsprefs.edit().putBoolean("sysOverlay", true).apply();
            switchshutdowncountdown.setChecked(true);
        } else {
            settingsprefs.edit().putBoolean("sysOverlay", false).apply();
            switchshutdowncountdown.setChecked(false);
        }
    } else if (requestCode == REQUEST_CODE_ENABLE) {
        settingsprefs.edit().putBoolean("pinprotection", true).apply();
        changepin.setVisibility(View.VISIBLE);
        changepindivider.setVisibility(View.VISIBLE);
    }
}
项目:android.java    文件:SubscribesUIController.java   
private void setChannel(String subscribeType, Subscription subscription, SwitchCompat email, SwitchCompat push, SwitchCompat sms) {
    if (subscribeType.equalsIgnoreCase(subscription.getType())) {
        for (Channel channel : subscription.getChannels()) {
            if (Channel.CHANNEL_EMAIL.equalsIgnoreCase(channel.getName())) {
                if (email != null) {
                    email.setChecked(channel.isEnabled());
                }
            } else if (Channel.CHANNEL_PUSH.equalsIgnoreCase(channel.getName())) {
                if (push != null) {
                    push.setChecked(channel.isEnabled());
                }
            } else if (Channel.CHANNEL_SMS.equalsIgnoreCase(channel.getName())) {
                if (sms != null) {
                    sms.setChecked(channel.isEnabled());
                }
            }
        }
    }
}
项目:shengyiplus-android    文件:TableFilterListAdapter.java   
@Override
public void convert(ViewHolder holder, final Filter filter) {
    TextView tvFilterName = holder.getView(R.id.tv_filter_name);
    SwitchCompat switchCompat = holder.getView(R.id.swipe_content);
    tvFilterName.setText(filter.name);
    switchCompat.setChecked(filter.isSelected);
    final RecyclerView recyclerView = holder.getView(R.id.recycler_view);
    TableFilterItemAdapter adapter = new TableFilterItemAdapter(context, filter.items, lisenter, filter.isAllcheck);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(context);
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(mLayoutManager);
    recyclerView.setAdapter(adapter);
    recyclerView.setVisibility(filter.isSelected ? View.VISIBLE : View.GONE);
    switchCompat.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            filter.isSelected = !filter.isSelected;
            recyclerView.setVisibility(filter.isSelected ? View.VISIBLE : View.GONE);
        }
    });
}
项目:Status    文件:BooleanPreferenceData.java   
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    super.onBindViewHolder(holder, position);

    SwitchCompat titleView = (SwitchCompat) holder.v.findViewById(R.id.title);

    titleView.setOnCheckedChangeListener(null);
    titleView.setChecked(value);
    titleView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            value = b;

            PreferenceUtils.PreferenceIdentifier identifier = getIdentifier().getPreference();
            if (identifier != null)
                PreferenceUtils.putPreference(getContext(), getIdentifier().getPreference(), b);
            onPreferenceChange(b);
        }
    });
}
项目:BasePopup    文件:DismissControlPopupFrag.java   
@Override
public void bindEvent() {
    mButton = (Button) mFragment.findViewById(R.id.popup_show);
    switchDismissWhenTouchOutside = (SwitchCompat) mFragment.findViewById(R.id.switch_dismiss_when_touch_outside);
    switchBackpressEnable = (SwitchCompat) mFragment.findViewById(R.id.switch_backpress_enable);
    switchInterceptTouchEvent = (SwitchCompat) mFragment.findViewById(R.id.switch_intercept_touch_event);
    mListView = (ListView) mFragment.findViewById(R.id.list_view);
    setAdapter(getActivity(), getData());
    mDismissControlPopup = new DismissControlPopup(mContext);
    mDismissControlPopup.setOnBeforeShowCallback(new BasePopupWindow.OnBeforeShowCallback() {
        @Override
        public boolean onBeforeShow(View popupRootView, View anchorView, boolean hasShowAnima) {
            mDismissControlPopup.setDismissWhenTouchOutside(switchDismissWhenTouchOutside.isChecked());
            mDismissControlPopup.setBackPressEnable(switchBackpressEnable.isChecked());
            mDismissControlPopup.setInterceptTouchEvent(switchInterceptTouchEvent.isChecked());
            return true;
        }
    });
    mButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDismissControlPopup.showPopupWindow(v);
        }
    });
}
项目:ProjectOxford-Apps-MimickerAlarm    文件:AlarmListFragment.java   
public AlarmHolder(View itemView) {
    super(itemView);
    itemView.setOnClickListener(this);

    mTitleTextView = (TextView) itemView.findViewById(R.id.list_item_alarm_title_text_view);
    mTimeTextView = (TextView) itemView.findViewById(R.id.list_item_alarm_time_text_view);
    mAlarmEnabled = (SwitchCompat) itemView.findViewById(R.id.list_item_alarm_enabled_switch);
    mContainer = (RelativeLayout) itemView.findViewById(R.id.list_item_container);

    mAlarmEnabled.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mAlarmEnabled.isChecked()) {
                long alarmTime = mAlarm.schedule();
                Toast.makeText(getActivity(),
                        DateTimeUtilities.getTimeUntilAlarmDisplayString(getActivity(), alarmTime),
                        Toast.LENGTH_LONG)
                        .show();
            } else {
                mAlarm.cancel();
            }
            mCallbacks.onAlarmChanged();
        }
    });
}
项目:privacy-friendly-shopping-list    文件:ListDialogCache.java   
public ListDialogCache(View rootview)
{
    prioritySpinner = (Spinner) rootview.findViewById(R.id.priority_spinner);
    reminderSpinner = (Spinner) rootview.findViewById(R.id.reminder_spinner);
    listNameText = (TextInputEditText) rootview.findViewById(R.id.list_name);
    listNameInputLayout = (TextInputLayout) rootview.findViewById(R.id.list_name_input_layout);
    reminderText = (TextInputEditText) rootview.findViewById(R.id.edittext_reminder);
    listNotes = (TextInputEditText) rootview.findViewById(R.id.list_notes);
    checkBox = (CheckBox) rootview.findViewById(R.id.list_dialog_checkbox);
    deadlineExpansionButton = (ImageView) rootview.findViewById(R.id.expand_button_list);
    deadlineLayout = (LinearLayout) rootview.findViewById(R.id.deadline_layout);
    dateLayout = (LinearLayout) rootview.findViewById(R.id.deadline_date);
    timeLayout = (LinearLayout) rootview.findViewById(R.id.deadline_time);
    reminderLayout = (LinearLayout) rootview.findViewById(R.id.layout_reminder);
    dateTextView = (TextView) rootview.findViewById(R.id.date_view);
    timeTextView = (TextView) rootview.findViewById(R.id.time_view);
    titleTextView = (TextView) rootview.findViewById(R.id.dialog_title);
    statisticsSwitch = (SwitchCompat) rootview.findViewById(R.id.switch_statistics);
    reminderSwitch = (SwitchCompat) rootview.findViewById(R.id.switch_reminder);
}
项目:Torchie-Android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setTitle("");

    but_flash = (ImageButton) findViewById(R.id.but_flash_pto);
    sw_func_toggle = (SwitchCompat) findViewById(R.id.sw_func_toggle);

    transAnimButFlash = (TransitionDrawable) but_flash.getBackground();
    transAnimButFlash.resetTransition();

    if (SettingsUtils.isFirstTime(this)) {
        this.showDialogWelcome();
    }
}
项目:android-protwall    文件:ActivityLog.java   
@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);
    }
}
项目:fdroid    文件:StartSwapView.java   
private void uiInitBluetooth() {
    if (bluetooth != null) {

        textBluetoothVisible = (TextView) findViewById(R.id.bluetooth_visible);

        viewBluetoothId = (TextView) findViewById(R.id.device_id_bluetooth);
        viewBluetoothId.setText(bluetooth.getName());
        viewBluetoothId.setVisibility(bluetooth.isEnabled() ? View.VISIBLE : View.GONE);

        int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth;
        textBluetoothVisible.setText(textResource);

        bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth);
        Utils.debugLog(TAG, getManager().isBluetoothDiscoverable() ? "Initially marking switch as checked, because Bluetooth is discoverable." : "Initially marking switch as not-checked, because Bluetooth is not discoverable.");
        bluetoothSwitch.setOnCheckedChangeListener(onBluetoothSwitchToggled);
        setBluetoothSwitchState(getManager().isBluetoothDiscoverable(), true);

        LocalBroadcastManager.getInstance(getContext()).registerReceiver(onBluetoothSwapStateChanged, new IntentFilter(SwapService.BLUETOOTH_STATE_CHANGE));

    } else {
        findViewById(R.id.bluetooth_info).setVisibility(View.GONE);
    }
}
项目:aptoide-client-v8    文件:AdultRowWidget.java   
@Override protected void assignViews(View itemView) {
  adultSwitch = (SwitchCompat) itemView.findViewById(R.id.adult_content);
  adultPinSwitch = (SwitchCompat) itemView.findViewById(R.id.pin_adult_content);

  adultContentConfirmationDialog =
      new RxAlertDialog.Builder(getContext()).setMessage(R.string.are_you_adult)
          .setPositiveButton(R.string.yes)
          .setNegativeButton(R.string.no)
          .build();

  enableAdultContentPinDialog =
      new PinDialog.Builder(getContext()).setMessage(R.string.request_adult_pin)
          .setPositiveButton(R.string.ok)
          .setNegativeButton(R.string.cancel)
          .setView(R.layout.dialog_requestpin)
          .setEditText(R.id.pininput)
          .build();

  trackAnalytics = true;
  adultContent = ((AptoideApplication) getContext().getApplicationContext()).getAdultContent();
}
项目:android.java    文件:SubscribesUIController.java   
private Subscription getSubscribe(String subscribeType, SwitchCompat email, SwitchCompat push, SwitchCompat sms) {
    Subscription result = new Subscription(subscribeType);
    List<Channel> channels = new ArrayList<Channel>(3);
    Channel channel;
    if (email != null) {
        channel = getChannel(Channel.CHANNEL_EMAIL, email);
        channels.add(channel);
    }
    if (push != null) {
        channel = getChannel(Channel.CHANNEL_PUSH, push);
        channels.add(channel);
    }
    if (sms != null) {
        channel = getChannel(Channel.CHANNEL_SMS, sms);
        channels.add(channel);
    }
    result.setChannels(channels);
    return result;
}
项目:AndroidChromium    文件:TranslateInfoBar.java   
@Override
public void onOptionsChanged() {
    if (mNativeTranslateInfoBarPtr == 0) return;

    // Handle the "Always Translate" checkbox.
    if (getInfoBarType() == AFTER_TRANSLATE_INFOBAR) {
        SwitchCompat alwaysSwitch = (SwitchCompat) getView().findViewById(
                R.id.translate_infobar_always_toggle);
        mOptions.toggleAlwaysTranslateLanguageState(alwaysSwitch.isChecked());
    }

    if (mOptions.optionsChanged()) {
        nativeApplyTranslateOptions(mNativeTranslateInfoBarPtr, mOptions.sourceLanguageCode(),
                mOptions.targetLanguageCode(), mOptions.alwaysTranslateLanguageState(),
                mOptions.neverTranslateLanguageState(), mOptions.neverTranslateDomainState());
    }
}
项目:ZzRatingBar    文件:MainActivity.java   
private void initView() {
    ratingBar = (ZzRatingBar) findViewById(R.id.zzratingbar);

    tvResult = (TextView) findViewById(R.id.tv_result);
    sb = (SeekBar) findViewById(R.id.seekbar);
    sw = (SwitchCompat) findViewById(R.id.sw);
    sw.setChecked(ratingBar.isClickEnable());
    btnOne = (Button) findViewById(R.id.btn_one);
    btnTwo = (Button) findViewById(R.id.btn_two);
    btnThree = (Button) findViewById(R.id.btn_three);
    btnFour = (Button) findViewById(R.id.btn_four);
    btnSizeOne = (Button) findViewById(R.id.btn_size_one);
    btnSizeTwo = (Button) findViewById(R.id.btn_size_two);
    btnSizeThree = (Button) findViewById(R.id.btn_size_three);
    btnCountFour = (Button) findViewById(R.id.btn_count_four);
    btnCountFive = (Button) findViewById(R.id.btn_count_five);
    btnStyleOne = (Button) findViewById(R.id.btn_style_one);
    btnStyleTwo = (Button) findViewById(R.id.btn_style_two);

}
项目:KeeLink    文件:MainActivity.java   
private void prepareMenu(Menu m) {
    if(m != null) {
        SwitchCompat switchh = (SwitchCompat) ((MenuItemImpl) m.findItem(R.id.menu_item_switch)).getActionView().findViewById(R.id.pluginEnabledSwitch);
        if(isKeepassInstalled()) {
            switchh.setEnabled(true);
            switchh.setChecked(isEnabled());
            switchh.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                    enableDisablePlugin();
                }
            });
        } else
            switchh.setChecked(false);

        try {
            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
            String version = pInfo.versionName;
            m.findItem(R.id.menuVersion).setTitle("v:" + version);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}
项目:yield    文件:EventEditView.java   
public EventEditView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    inflate(context, R.layout.event_edit_view, this);
    int horizontalPadding = context.getResources()
            .getDimensionPixelSize(R.dimen.horizontal_padding),
            verticalPadding = context.getResources()
                    .getDimensionPixelSize(R.dimen.vertical_padding);
    setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding);
    mTextInputTitle = (TextInputLayout) findViewById(R.id.text_input_title);
    mEditTextTitle = (EditText) findViewById(R.id.edit_text_title);
    mSwitchAllDay = (SwitchCompat) findViewById(R.id.switch_all_day);
    mTextViewStartDate = (TextView) findViewById(R.id.text_view_start_date);
    mTextViewStartTime = (TextView) findViewById(R.id.text_view_start_time);
    mTextViewEndDate = (TextView) findViewById(R.id.text_view_end_date);
    mTextViewEndTime = (TextView) findViewById(R.id.text_view_end_time);
    mTextViewCalendar = (TextView) findViewById(R.id.text_view_calendar);
    mTransparentColor = ContextCompat.getColor(context, android.R.color.transparent);
    if (isInEditMode()) {
        mColors = new int[]{mTransparentColor};
    } else {
        mColors = ViewUtils.getCalendarColors(context);
    }
    setupViews();
    setEvent(mEvent);
}
项目:AndroidSmartHome    文件:SaklarAdapter.java   
public SaklarHolder(View view) {
    super(view);

    saklarName = (TextView) view.findViewById(R.id.saklar_text);
    saklarSwitch = (SwitchCompat) view.findViewById(R.id.saklar_switch);
    saklarIcon = (ImageView) view.findViewById(R.id.saklar_icon);

    // Click Listener
    view.setClickable(true);
    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int position = getAdapterPosition();
            if (saklarItemClickListener != null) {
                saklarItemClickListener.onClick(v, position);
            }
        }
    });
}
项目:getwild    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    serviceSwitch = (SwitchCompat) findViewById(R.id.service_witch);
    serviceSwitch.setChecked(isServiceRunning("com.futabooo.getwild.GetWildListenerService"));
    serviceSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // Service止められてないときの保険
            SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            if (isChecked) {
                sp.edit().putBoolean("isEnable", true).commit();
                startService(new Intent(MainActivity.this, GetWildListenerService.class));
            } else {
                sp.edit().putBoolean("isEnable", false).commit();
                stopService(new Intent(MainActivity.this, GetWildListenerService.class));
            }
            buttonView.setChecked(isChecked);
        }
    });
}
项目:dash-api    文件:AppAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.app_list_item, parent, false);
    final UUID thisUuid = UUID.fromString(uuids[position]);

    TextView nameView = (TextView)rowView.findViewById(R.id.app_name);
    nameView.setText(PermissionManager.getName(context, thisUuid));

    TextView uuidView = (TextView)rowView.findViewById(R.id.app_uuid);
    uuidView.setText(thisUuid.toString());

    SwitchCompat permSwitch = (SwitchCompat) rowView.findViewById(R.id.app_switch);
    boolean permitted = PermissionManager.isPermitted(context, thisUuid);
    permSwitch.setChecked(permitted);
    permSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            PermissionManager.setPermitted(context, thisUuid, isChecked);
        }

    });

    return rowView;
}
项目:MaterialHome    文件:MainActivity.java   
private void initNavView() {
    boolean night = SPUtils.getPrefBoolean(Constant.THEME_MODEL, false);
    if (night) {
        getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
    } else {
        getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
    }
    MenuItem item = mNavigationView.getMenu().findItem(R.id.nav_theme);
    mNavigationView.getMenu().findItem(R.id.nav_home).setChecked(true);
    mThemeSwitch = (SwitchCompat) MenuItemCompat.getActionView(item).findViewById(R.id.view_switch);
    mThemeSwitch.setChecked(night);
    mThemeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            SPUtils.setPrefBoolean(Constant.THEME_MODEL, isChecked);
            mThemeSwitch.setChecked(isChecked);
            if (isChecked) {
                getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_YES);
            } else {
                getDelegate().setLocalNightMode(AppCompatDelegate.MODE_NIGHT_NO);
            }
        }
    });
}
项目:Tapad    文件:SettingsActivity.java   
private void setFocusLoss() {
    final boolean focusLoss = preferences.getStopOnFocusLoss();
    final SwitchCompat focusLossSwitch = w.getSwitchCompat(R.id.layout_settings_focus_loss_switch, a);
    RelativeLayout focusLossLayout = w.getRelativeLayout(R.id.layout_settings_focus_loss, a);

    focusLossSwitch.setChecked(focusLoss);
    focusLossSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b != focusLoss) {
                // changed
                isDeckShouldCleared = true;
            }
            preferences.setStopOnFocusLoss(b);
        }
    });

    focusLossLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            focusLossSwitch.toggle();
        }
    });
}
项目:Tapad    文件:SettingsActivity.java   
private void setStopLoop() {
    final boolean stopLoop = preferences.getStopLoopOnSingle();
    final SwitchCompat stopLoopSwitch = w.getSwitchCompat(R.id.layout_settings_stop_loop_switch, a);
    RelativeLayout stopLoopLayout = w.getRelativeLayout(R.id.layout_settings_stop_loop, a);

    stopLoopSwitch.setChecked(stopLoop);
    stopLoopSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b != stopLoop) {
                // changed
                isDeckShouldCleared = true;
            }
            preferences.setStopLoopOnSingle(b);
            isStopLoopOnSingle = b;
        }
    });

    stopLoopLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            stopLoopSwitch.toggle();
        }
    });
}