android.widget.CheckBox Java Examples

The following examples show how to use android.widget.CheckBox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TintHelper.java    From a with GNU General Public License v3.0 6 votes vote down vote up
public static void setTint(@NonNull CheckBox box, @ColorInt int color, boolean useDarker) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_enabled},
            new int[]{android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[]{android.R.attr.state_enabled, android.R.attr.state_checked}
    }, new int[]{
            ContextCompat.getColor(box.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light),
            ContextCompat.getColor(box.getContext(), useDarker ? R.color.ate_control_normal_dark : R.color.ate_control_normal_light),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        box.setButtonTintList(sl);
    } else {
        Drawable drawable = createTintedDrawable(ContextCompat.getDrawable(box.getContext(), R.drawable.abc_btn_check_material), sl);
        box.setButtonDrawable(drawable);
    }
}
 
Example #2
Source File: MainActivity.java    From FastWebView with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    CheckBox checkBox = findViewById(R.id.checkbox);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            sUseWebViewPool = isChecked;
        }
    });

    findViewById(R.id.test_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(v.getContext(), WebViewActivity.class);
            startActivity(intent);
        }
    });
}
 
Example #3
Source File: AlarmClockAdapter.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
public AlarmClockItemView(View view)
{
    card = view.findViewById(R.id.layout_alarmcard);
    cardBackdrop = view.findViewById(R.id.layout_alarmcard0);
    typeButton = (ImageButton) view.findViewById(R.id.type_menu);
    text = (TextView) view.findViewById(android.R.id.text1);
    text2 = (TextView) view.findViewById(android.R.id.text2);
    text_date = (TextView) view.findViewById(R.id.text_date);
    text_datetime = (TextView) view.findViewById(R.id.text_datetime);
    text_location = (TextView) view.findViewById(R.id.text_location_label);
    text_ringtone = (TextView) view.findViewById(R.id.text_ringtone);
    check_vibrate = (CheckBox) view.findViewById(R.id.check_vibrate);
    option_repeat = (TextView) view.findViewById(R.id.option_repeat);
    option_offset = (TextView) view.findViewById(R.id.option_offset);
    overflow = (ImageButton) view.findViewById(R.id.overflow_menu);

    if (Build.VERSION.SDK_INT >= 14) {
        switch_enabled = (SwitchCompat) view.findViewById(R.id.switch_enabled);        // switch used by api >= 14 (otherwise null)
    } else {
        check_enabled = (CheckBox) view.findViewById(R.id.switch_enabled);              // checkbox used by api < 14 (otherwise null)
    }
}
 
Example #4
Source File: MainActivity.java    From Multiwii-Remote with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	//KeepScreenOn(app.KeepScreenOn);
	KeepScreenOn(true);
	
	rc = new RCSignals();
	// mCam = new Camera((MjpegView) this.findViewById(R.id.webcamView));
	mEvents = new MainActivityEvents(this);
	mHandler = new MainActivityCommunicationHandler(this);
	
	txtStatus = (TextView) findViewById(R.id.status);
	txtHeader = (TextView) findViewById(R.id.throttleView);
	txtUIDebug = (TextView) findViewById(R.id.debugTxt);
	for (int x = 0; x < auxBtn.length; x++)
		auxBtn[x] = (ToggleButton) findViewById(getResources().getIdentifier("aux" + (x + 1) + "Btn", "id",	getPackageName()));
       dualJoystickView = (DualJoystickView) findViewById(R.id.DualJoystickView);
       chkUsePhoneHeading = (CheckBox) findViewById(R.id.chkUsePhoneHeading);
	
	Init();
}
 
Example #5
Source File: SongAdapter.java    From Musicoco with Apache License 2.0 6 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);
    this.itemView = itemView;
    name = (TextView) itemView.findViewById(R.id.sheet_song_item_name);
    image = (ImageView) itemView.findViewById(R.id.sheet_song_item_image);
    favorite = (ImageView) itemView.findViewById(R.id.sheet_song_item_favorite);
    duration = (TextView) itemView.findViewById(R.id.sheet_song_item_duration);
    number = (TextView) itemView.findViewById(R.id.sheet_song_item_number);
    arts = (TextView) itemView.findViewById(R.id.sheet_song_item_arts);
    more = (ImageButton) itemView.findViewById(R.id.sheet_song_item_more);
    check = (CheckBox) itemView.findViewById(R.id.sheet_song_item_check);
    views = new View[]{
            name,
            image,
            favorite,
            duration,
            number,
            arts,
            more,
            check};

}
 
Example #6
Source File: LoginActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
private void initView() {
    this.mInputAccountLayout = (RelativeLayout) this.mRootView.findViewWithTag("umgr_login_layout_input_username");
    this.mInputAccount = (EditText) this.mRootView.findViewWithTag("umgr_login_input_username");
    this.mClearInputAccount = (Button) this.mRootView.findViewWithTag("umgr_login_clear_input_username");
    this.mInputPassword = (EditText) this.mRootView.findViewWithTag("umgr_login_input_password");
    this.mClearInputPassword = (Button) this.mRootView.findViewWithTag("umgr_login_clear_input_password");
    this.mRegister = (TextView) this.mRootView.findViewWithTag("umgr_login_register");
    this.mFindpwd = (TextView) this.mRootView.findViewWithTag("umgr_login_findpwd");
    this.mErrorPrompt = (TextView) this.mRootView.findViewWithTag("umgr_login_error_prompt");
    this.mLogin = (Button) this.mRootView.findViewWithTag("umgr_login_submit");
    this.mAgreeClause1 = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_1");
    this.mAgreeClauseUser = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_user");
    this.mAgreement = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_agreement");
    this.mAnd = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_and");
    this.mPrivacy = (TextView) this.mRootView.findViewWithTag("umgr_agree_clause_2_privacy");
    this.mShowPwd = (CheckBox) this.mRootView.findViewWithTag("umgr_login_show_password");
    this.mSwitchAccount = (TextView) this.mRootView.findViewWithTag("umgr_login_switch");
}
 
Example #7
Source File: MultipleChoiceOptionItemTest.java    From msdkui-android with Apache License 2.0 6 votes vote down vote up
@Test
public void testCallback() {
    mMultipleChoiceOptionItem.setListener(new OptionItem.OnChangedListener() {
        @Override
        public void onChanged(OptionItem item) {
            mCallbackCalled = true;
        }
    });
    final List<String> ids = Collections.singletonList(getString(R.string.msdkui_fastest));
    mMultipleChoiceOptionItem.setLabels(ids);
    assertThat(mMultipleChoiceOptionItem.getChildCount(), equalTo(1));
    final View view = mMultipleChoiceOptionItem.getChildAt(0);
    final TextView labelView = (TextView) view.findViewById(R.id.multiple_item_label);
    final CheckBox selectionView = (CheckBox) view.findViewById(R.id.multiple_item_value);
    assertNotNull(labelView);
    assertNotNull(selectionView);
    selectionView.setChecked(true);
    assertThat(mCallbackCalled, is(true));
}
 
Example #8
Source File: GosDeviceResetActivity.java    From gokit-android with MIT License 6 votes vote down vote up
private void initView() {
	cbSelect = (CheckBox) findViewById(R.id.cbSelect);
	tvSelect = (TextView) findViewById(R.id.tvSelect);
	btnNext = (Button) findViewById(R.id.btnNext);

	/** 加载Gif */
	GifView gif = (GifView) findViewById(R.id.softreset);
	gif.setMovieResource(R.drawable.resetsoftap);

	/** 加载标志位 */
	flag = getIntent().getStringExtra("flag").toString();

	// 配置文件部署
	btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor());
	btnNext.setTextColor(GosDeploy.setButtonTextColor());

}
 
Example #9
Source File: TranslateCheckBox.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void createContent(Context context, InfoBarLayout layout) {
    CheckBox checkBox = new CheckBox(context);
    checkBox.setId(R.id.infobar_extra_check);
    checkBox.setText(context.getString(R.string.translate_always_text,
            mOptions.sourceLanguage()));
    checkBox.setChecked(mOptions.alwaysTranslateLanguageState());
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton view, boolean isChecked) {
            mOptions.toggleAlwaysTranslateLanguageState(isChecked);
            if (isChecked){
                mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
            } else {
                mListener.onOptionsChanged();
            }
        }
    });
    layout.addGroup(checkBox);
}
 
Example #10
Source File: HorMediaControllView.java    From likequanmintv with Apache License 2.0 6 votes vote down vote up
private void initView(Context context) {
    rootView = View.inflate(context, R.layout.widget_hor_controller, this);
    layout_topbar = (RelativeLayout) findViewById(R.id.layout_topbar);
    img_btn_back = (ImageView) findViewById(R.id.img_btn_back);
    top_ll = (LinearLayout) findViewById(R.id.top_ll);
    check_gift_switch = (CheckBox) findViewById(R.id.check_gift_switch);
    txt_btn_clarity = (TextView) findViewById(R.id.txt_btn_clarity);
    check_focus = (CheckBox) findViewById(R.id.check_focus);
    img_btn_share = (ImageView) findViewById(R.id.img_btn_share);
    txt_btn_describe = (TextView) findViewById(R.id.txt_btn_describe);
    txt_get_seed = (TextView) findViewById(R.id.txt_get_seed);
    lv_quality = (ListView) findViewById(R.id.lv_quality);
    tv_volume_brightness = (TextView) findViewById(R.id.tv_volume_brightness);
    layout_bottom_thelive = (LinearLayout) findViewById(R.id.layout_bottom_thelive);
    player_switch = (CheckBox) findViewById(R.id.rad_btn_player_switch);
    img_btn_refresh = (ImageView) findViewById(R.id.img_btn_refresh);
    txt_btn_hot_word = (ImageView) findViewById(R.id.txt_btn_hot_word);
    ediit_comment = (EditText) findViewById(R.id.ediit_comment);
    img_btn_send = (ImageView) findViewById(R.id.img_btn_send);
    rad_btn_danmu_switch = (CheckBox) findViewById(R.id.rad_btn_danmu_switch);
    img_btn_gift = (ImageView) findViewById(R.id.img_btn_gift);
}
 
Example #11
Source File: ImageDetailFragment.java    From AlbumSelector with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragmetn_image_detail, container, false);
    mViewPager = (ViewPager) rootView.findViewById(R.id.view_pager);
    mCheckBox = (CheckBox) rootView.findViewById(R.id.cb_checkbox);
    mCheckBox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int position = mViewPager.getCurrentItem();
            ImageInfo currentItem = mPagerAdapter.getItem(position);
            if (!currentItem.isSelected()) {
                mPresenter.selectImage(currentItem, mAlbumConfig.getMaxCount(), position);
            } else {
                mPresenter.unSelectImage(currentItem, position);
            }
        }
    });
    mPagerAdapter = new ImageDetailAdapter(Glide.with(mContext), mImageInfos);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setCurrentItem(mCurrentPosition);
    mViewPager.addOnPageChangeListener(onPageChangeListener);
    mCheckBox.setChecked(mImageInfos.get(mCurrentPosition).isSelected());
    updateIndicator();
    return rootView;
}
 
Example #12
Source File: DocumentCentricAppsUnitTest.java    From android-DocumentCentricApps with Apache License 2.0 6 votes vote down vote up
public void testNewDocumentButton_FlagMultipleSetWhenCheckboxIsChecked() {
    // Given a initialized Activity and ticked "Create new task" checkbox
    assertNotNull("mDocumentCentricActivity is null", mDocumentCentricActivity);
    final Button createNewDocumentButton = (Button) mDocumentCentricActivity
            .findViewById(R.id.new_document_button);
    assertNotNull(createNewDocumentButton);
    final CheckBox newTaskCheckbox = (CheckBox) mDocumentCentricActivity
            .findViewById(R.id.multiple_task_checkbox);
    assertNotNull(newTaskCheckbox);
    newTaskCheckbox.setChecked(true);

    // When "Create new Document" Button is clicked
    createNewDocumentButton.performClick();

    // Then NewDocumentActivity is started with the new document and multiple task flags
    final Intent newDocumentIntent = getStartedActivityIntent();
    assertNotNull("newDocumentIntent is null", newDocumentIntent);
    assertEquals("intent is missing flag FLAG_ACTIVITY_NEW_DOCUMENT", Intent.FLAG_ACTIVITY_NEW_DOCUMENT,
            newDocumentIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
    assertEquals("intent is missing flag FLAG_ACTIVITY_MULTIPLE_TASK", Intent.FLAG_ACTIVITY_MULTIPLE_TASK,
            newDocumentIntent.getFlags() & Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
}
 
Example #13
Source File: LibRefreshDialogFragment.java    From Hentoid with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View rootView, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(rootView, savedInstanceState);

    if (rootView instanceof ViewGroup) this.rootView = (ViewGroup) rootView;

    if (showOptions) { // Show option screen first
        CheckBox renameChk = requireViewById(rootView, R.id.refresh_options_rename);
        CheckBox cleanAbsentChk = requireViewById(rootView, R.id.refresh_options_remove_1);
        CheckBox cleanNoImagesChk = requireViewById(rootView, R.id.refresh_options_remove_2);
        CheckBox cleanUnreadableChk = requireViewById(rootView, R.id.refresh_options_remove_3);

        View okBtn = requireViewById(rootView, R.id.refresh_ok);
        okBtn.setOnClickListener(v -> launchRefreshImport(renameChk.isChecked(), cleanAbsentChk.isChecked(), cleanNoImagesChk.isChecked(), cleanUnreadableChk.isChecked()));
    } else { // Show import progress layout immediately
        showImportProgressLayout(chooseFolder);
    }
}
 
Example #14
Source File: MainActivity.java    From AppCrawler with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mPkgMgr = getPackageManager();
    try {
        mPkgInfo = mPkgMgr.getPackageInfo(getPackageName(), 0);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    mListView = (ListView) findViewById(R.id.appList);
    mRadioBtnPackage = (RadioButton) findViewById(R.id.radioPackage);
    mRadioBtnName = (RadioButton) findViewById(R.id.radioName);
    mCheckBoxHideAndroid = (CheckBox) findViewById(R.id.checkBoxHideAndroid);
    mCheckBoxHideGoogle = (CheckBox) findViewById(R.id.checkBoxHideGoogle);

    refreshAppListView();
}
 
Example #15
Source File: EditCardViewUnitTest.java    From braintree-android-drop-in with MIT License 5 votes vote down vote up
@Test
public void setup_withDropInRequestShowingSaveCardCheckBoxAndPreChecked_showsSaveCardCheckboxChecked() {
    Configuration configuration = new TestConfigurationBuilder()
            .buildConfiguration();
    DropInRequest dropInRequest = new DropInRequest()
            .allowVaultCardOverride(true)
            .vaultCard(true);

    mView.setup(mActivity, configuration, dropInRequest);

    CheckBox checkBox = mView.findViewById(R.id.bt_card_form_save_card_checkbox);
    assertThat(checkBox).isVisible();
    assertThat(checkBox).isChecked();
}
 
Example #16
Source File: ImageSearchLayout.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public void init(Context context) {
    setOrientation(VERTICAL);
    setDividerDrawable(context.getResources().getDrawable(R.drawable.spacer_keyline));
    setShowDividers(SHOW_DIVIDER_MIDDLE);
    LayoutInflater.from(context).inflate(R.layout.widget_image_search, this);

    mPreview = (ImageView) ViewUtils.$$(this, R.id.preview);
    mSelectImage = ViewUtils.$$(this, R.id.select_image);
    mSearchUSS = (CheckBox) ViewUtils.$$(this, R.id.search_uss);
    mSearchOSC = (CheckBox) ViewUtils.$$(this, R.id.search_osc);
    mSearchSE = (CheckBox) ViewUtils.$$(this, R.id.search_se);

    mSelectImage.setOnClickListener(this);
}
 
Example #17
Source File: SetSecurityActivity.java    From MHViewer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_set_security);
    setNavigationIcon(R.drawable.v_arrow_left_dark_x24);

    mPatternView = (LockPatternView) ViewUtils.$$(this, R.id.pattern_view);
    mCancel = ViewUtils.$$(this, R.id.cancel);
    mSet = ViewUtils.$$(this, R.id.set);
    mFingerprint = (CheckBox) ViewUtils.$$(this, R.id.fingerprint_checkbox);

    String pattern = Settings.getSecurity();
    if (!TextUtils.isEmpty(pattern)) {
        mPatternView.setPattern(LockPatternView.DisplayMode.Correct,
                LockPatternUtils.stringToPattern(pattern));
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
        FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class);
        // The line below prevents the false positive inspection from Android Studio
        // noinspection ResourceType
        if (fingerprintManager != null && hasEnrolledFingerprints(fingerprintManager)) {
            mFingerprint.setVisibility(View.VISIBLE);
            mFingerprint.setChecked(Settings.getEnableFingerprint());
        }
    }

    mCancel.setOnClickListener(this);
    mSet.setOnClickListener(this);
}
 
Example #18
Source File: CaptureDemoFragment.java    From LandscapeVideoCamera with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    final View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    final Button captureBtn = (Button) rootView.findViewById(R.id.btn_capturevideo);
    captureBtn.setOnClickListener(this);

    thumbnailIv = (ImageView) rootView.findViewById(R.id.iv_thumbnail);
    thumbnailIv.setOnClickListener(this);
    statusTv = (TextView) rootView.findViewById(R.id.tv_status);
    advancedRl = (RelativeLayout) rootView.findViewById(R.id.rl_advanced);
    filenameEt = (EditText) rootView.findViewById(R.id.et_filename);
    fpsEt = (EditText) rootView.findViewById(R.id.et_fps);
    maxDurationEt = (EditText) rootView.findViewById(R.id.et_duration);
    maxFilesizeEt = (EditText) rootView.findViewById(R.id.et_filesize);
    showTimerCb = (CheckBox) rootView.findViewById(R.id.cb_showtimer);
    allowFrontCameraCb = (CheckBox) rootView.findViewById(R.id.cb_show_camera_switch);


    if (savedInstanceState != null) {
        statusMessage = savedInstanceState.getString(KEY_STATUSMESSAGE);
        filename = savedInstanceState.getString(KEY_FILENAME);
        advancedRl.setVisibility(savedInstanceState.getInt(KEY_ADVANCEDSETTINGS));
    }

    updateStatusAndThumbnail();
    initializeSpinners(rootView);
    return rootView;
}
 
Example #19
Source File: ChecklistAdapter.java    From Travel-Mate with MIT License 5 votes vote down vote up
@OnClick(R.id.row_cb)
public void onClickCheckbox(View v) {

    int position = getAdapterPosition();

    if (((CheckBox) v).isChecked()) {
        // updating isDone to true in database
        mDisposable.add(mViewModel.updateIsDone(mItems.get(position).getId(), true)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe());

        mDatabase.widgetCheckListDao().updateIsDone(mItems.get(position).getId(), true);
    } else {
        // updating isDone to false in database
        mDisposable.add(mViewModel.updateIsDone(mItems.get(position).getId(), false)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe());

        mDatabase.widgetCheckListDao().updateIsDone(mItems.get(position).getId(), false);
    }

    if (mListener != null) {
        mListener.onItemCheckedChange();
    }
}
 
Example #20
Source File: SuggestionDialogFragment.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
public void suggestionSubscriptionUpdated(Suggestion model) {
    CheckBox checkbox = (CheckBox) headerView.findViewById(R.id.uv_subscribe_checkbox);
    if (suggestion.isSubscribed()) {
        Toast.makeText(getActivity(), R.string.uv_msg_subscribe_success, Toast.LENGTH_SHORT).show();
        checkbox.setChecked(true);
    } else {
        Toast.makeText(getActivity(), R.string.uv_msg_unsubscribe, Toast.LENGTH_SHORT).show();
        checkbox.setChecked(false);
    }
    displaySuggestion(view, suggestion);
    if (getActivity() instanceof ForumActivity)
        ((ForumActivity) getActivity()).suggestionUpdated(model);
}
 
Example #21
Source File: GroupViewHolder.java    From Android-ContactPicker with Apache License 2.0 5 votes vote down vote up
GroupViewHolder(View root) {
    super(root);

    mRoot = root;
    mSelect = (CheckBox) root.findViewById(R.id.select);
    mName = (TextView) root.findViewById(R.id.name);
    mDescription = (TextView) root.findViewById(R.id.description);
}
 
Example #22
Source File: UiSettingsDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
public void setRotateGesturesEnabled(View v) {
    if (!checkReady()) {
        return;
    }
    // Enables/disables rotate gestures.
    mUiSettings.setRotateGesturesEnabled(((CheckBox) v).isChecked());
}
 
Example #23
Source File: SettingActivity.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setting);

    Intent intent = new Intent(this, SwitchBotMessageService.class);
    bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);

    CheckBox checkBox = findViewById(R.id.checkbox_local_oauth);
    checkBox.setChecked(Settings.getBoolean(this, Settings.KEY_LOCAL_OAUTH, true));
    checkBox.setOnCheckedChangeListener((compoundButton, value) -> {
        if(checkBox.isFocusable()) {
            if(mSwitchBotMessageService != null) {
                Settings.setBoolean(this, Settings.KEY_LOCAL_OAUTH, value);
                mSwitchBotMessageService.setLocalOAuthPreference(value);
            }
        }
    });

    findViewById(R.id.text_title_device_register).setOnClickListener((view) -> {
        Intent registerActivity = new Intent(this, RegisterActivity.class);
        startActivity(registerActivity);
    });

    findViewById(R.id.text_title_device_modify_and_delete).setOnClickListener((view) -> {
        Intent modifyAndDeleteActivity = new Intent(this, ModifyAndDeleteActivity.class);
        startActivity(modifyAndDeleteActivity);
    });

    findViewById(R.id.text_title_demo_app).setOnClickListener((view) -> {
        Intent demoPageSettingActivity = new Intent(this, DemoPageSettingActivity.class);
        startActivity(demoPageSettingActivity);
    });
}
 
Example #24
Source File: KillActivity.java    From Lanmitm with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState, com.oinux.lanmitm.R.layout.kill_activity);

	setBarTitle(Html.fromHtml("<b>" + getString(R.string.prohibit_internet)
			+ "</b> - <small>" + AppContext.getTarget().getIp() + "</small>"));

	headerView = findViewById(R.id.header_view);

	killCheckBox = (CheckBox) findViewById(R.id.kill_check_box);
	if (AppContext.isKillRunning) {
		killCheckBox.setChecked(true);
	} else {
		killCheckBox.setChecked(false);
	}
	killCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			Intent intent = new Intent(KillActivity.this, KillService.class);
			if (isChecked) {
				if (AppContext.isHijackRunning)
					stopService(new Intent(KillActivity.this,
							HijackService.class));
				if (AppContext.isInjectRunning)
					stopService(new Intent(KillActivity.this,
							InjectService.class));
				if (AppContext.isTcpdumpRunning)
					stopService(new Intent(KillActivity.this,
							SnifferService.class));
				headerView.setVisibility(View.VISIBLE);
				startService(intent);
			} else {
				headerView.setVisibility(View.GONE);
				stopService(intent);
			}
		}
	});
}
 
Example #25
Source File: BlurDialogActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.blur_dialog_activity_sample);

    findViewById(R.id.button).setOnClickListener(this);
    mBlurRadiusTextView = ((TextView) findViewById(R.id.blurRadius));
    mBlurRadiusSeekbar = ((SeekBar) findViewById(R.id.blurRadiusSeekbar));
    mDownScaleFactorTextView = ((TextView) findViewById(R.id.downScalefactor));
    mDownScaleFactorSeekbar = ((SeekBar) findViewById(R.id.downScaleFactorSeekbar));
    mDebugMode = ((CheckBox) findViewById(R.id.debugMode));

    setUpView();
}
 
Example #26
Source File: DebitCardPayActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void initView() {
    this.lepay_payload_layer = (MontmorilloniteLayer) findViewById(ResourceUtil.getIdResource(this, "lepay_payload_layer"));
    this.lepay_ll_parent = (LinearLayout) findViewById(ResourceUtil.getIdResource(this, "lepay_ll_parent"));
    this.lepay_et_cardNo = (ClearEditText) findViewById(ResourceUtil.getIdResource(this, "lepay_et_cardNo"));
    this.lepay_et_exp = (ClearEditText) findViewById(ResourceUtil.getIdResource(this, "lepay_et_exp"));
    this.lepay_et_cvv2 = (ClearEditText) findViewById(ResourceUtil.getIdResource(this, "lepay_et_cvv2"));
    this.lepay_et_mobile = (ClearEditText) findViewById(ResourceUtil.getIdResource(this, "lepay_et_mobile"));
    this.lepay_et_checkcode = (ClearEditText) findViewById(ResourceUtil.getIdResource(this, "lepay_et_checkcode"));
    this.lepay_tv_cardNo_hint = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_cardNo_hint"));
    this.lepay_tv_exp_hint = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_exp_hint"));
    this.lepay_tv_cvv2_hint = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_cvv2_hint"));
    this.lepay_tv_mobile_hint = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_mobile_hint"));
    this.lepay_tv_checkcode_hint = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_checkcode_hint"));
    this.lepay_iv_cardNo_clean = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_cardNo_clean"));
    this.lepay_iv_cardno_question = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_cardno_question"));
    this.lepay_iv_exp_question = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_exp_question"));
    this.lepay_iv_cvv2_question = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_cvv2_question"));
    this.lepay_iv_mobile_clean = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_mobile_clean"));
    this.lepay_iv_checkcode_clean = (ImageView) findViewById(ResourceUtil.getIdResource(this, "lepay_iv_checkcode_clean"));
    this.lepay_bt_checkcode = (Button) findViewById(ResourceUtil.getIdResource(this, "lepay_bt_checkcode"));
    this.lepay_pay_ok = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_pay_ok"));
    this.lepay_cashier_moeny = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_cashier_moeny"));
    this.lepay_rb_select = (CheckBox) findViewById(ResourceUtil.getIdResource(this, "lepay_rb_select"));
    this.lepay_tv_pay_protocol = (TextView) findViewById(ResourceUtil.getIdResource(this, "lepay_tv_pay_protocol"));
    this.progress = (ProgressBar) findViewById(ResourceUtil.getIdResource(this, "progress"));
    this.mActionBar = (LePayActionBar) findViewById(ResourceUtil.getIdResource(this, "lepay_actionbar"));
    this.mActionBar.setLeftButtonVisable(0);
}
 
Example #27
Source File: Update.java    From Mizuu with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mIsMovie = getIntent().getExtras().getBoolean("isMovie");

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    if (!mIsMovie)
        mToolbar.setTitle(getString(R.string.updateTvShowsTitle));

    setSupportActionBar(mToolbar);

    mTypeface = TypefaceUtils.getRobotoLight(this);

    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    mClearLibrary = (CheckBox) findViewById(R.id.checkBox);
    mClearLibrary.setTypeface(mTypeface);
    mClearLibrary.setChecked(false);
    mClearLibrary.setOnCheckedChangeListener(getOnCheckedChangeListener(true));

    mRemoveUnavailableFiles = (CheckBox) findViewById(R.id.checkBox2);
    mRemoveUnavailableFiles.setTypeface(mTypeface);
    mRemoveUnavailableFiles.setChecked(false);
    mRemoveUnavailableFiles.setOnCheckedChangeListener(getOnCheckedChangeListener(false));

    mFileSourcesDescription = (TextView) findViewById(R.id.file_sources_description);
    mFileSourcesDescription.setTypeface(mTypeface);
    mUpdateLibraryDescription = (TextView) findViewById(R.id.update_library_description);
    mUpdateLibraryDescription.setTypeface(mTypeface);

    mFileSourcesButton = (Button) findViewById(R.id.select_file_sources_button);
    mFileSourcesButton.setTypeface(mTypeface);
    mUpdateLibraryButton = (Button) findViewById(R.id.start_update_button);
    mUpdateLibraryButton.setTypeface(mTypeface);
}
 
Example #28
Source File: LoginActivity.java    From KUAS-AP-Material with MIT License 5 votes vote down vote up
private void findViews() {
	mIdEditText = (EditText) findViewById(R.id.editText_id);
	mIdTextInputLayout = (TextInputLayout) mIdEditText.getParent();
	mPasswordEditText = (EditText) findViewById(R.id.editText_password);
	mPasswordTextInputLayout = (TextInputLayout) mPasswordEditText.getParent();

	dot_ap = (ImageView) findViewById(R.id.dot_ap);
	dot_leave = (ImageView) findViewById(R.id.dot_leave);
	dot_bus = (ImageView) findViewById(R.id.dot_bus);

	mVersionTextView = (TextView) findViewById(R.id.textView_version);
	mRememberCheckBox = (CheckBox) findViewById(R.id.checkbox_remember);

	mLoginButton = (Button) findViewById(R.id.button_login);
}
 
Example #29
Source File: MainActivity.java    From android-midisuite with Apache License 2.0 5 votes vote down vote up
public void onToggleScreenLock(View view) {
    boolean checked = ((CheckBox) view).isChecked();
    if (checked) {
        getWindow()
                .addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
        getWindow()
                .clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}
 
Example #30
Source File: AddModuleAdapter.java    From StudentAttendanceCheck with MIT License 5 votes vote down vote up
public RecyclerViewHolder(View itemView) {
    super(itemView);

    addModuleModuleNameTxt = (TextView) itemView.findViewById(R.id.addModuleModuleNameTxt);
    addModuleModuleIdTxt = (TextView) itemView.findViewById(R.id.addModuleModuleIdTxt);
    addModuleCheckBox = (CheckBox) itemView.findViewById(R.id.addModuleCheckbox);

}