类android.widget.CheckBox源码实例Demo

下面列出了怎么用android.widget.CheckBox的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: AlbumSelector   文件: ImageDetailFragment.java
@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;
}
 
源代码2 项目: gokit-android   文件: GosDeviceResetActivity.java
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());

}
 
源代码3 项目: letv   文件: LoginActivity.java
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");
}
 
源代码4 项目: Multiwii-Remote   文件: MainActivity.java
@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();
}
 
源代码5 项目: FastWebView   文件: MainActivity.java
@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);
        }
    });
}
 
源代码6 项目: Musicoco   文件: SongAdapter.java
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};

}
 
源代码7 项目: android-chromium   文件: TranslateCheckBox.java
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);
}
 
源代码8 项目: likequanmintv   文件: HorMediaControllView.java
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);
}
 
源代码9 项目: AppCrawler   文件: MainActivity.java
@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();
}
 
源代码10 项目: a   文件: TintHelper.java
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);
    }
}
 
源代码11 项目: SuntimesWidget   文件: AlarmClockAdapter.java
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)
    }
}
 
@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));
}
 
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);
}
 
源代码14 项目: Hentoid   文件: LibRefreshDialogFragment.java
@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);
    }
}
 
源代码15 项目: CartLayout   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    recyclerView = ((RecyclerView) findViewById(R.id.recycler));
    mTvTitle = ((TextView) findViewById(R.id.tv_title));
    mTvEdit = ((TextView) findViewById(R.id.tv_edit));
    mCheckBoxAll = ((CheckBox) findViewById(R.id.checkbox_all));
    mTvTotal = ((TextView) findViewById(R.id.tv_total_price));
    mBtnSubmit = ((Button) findViewById(R.id.btn_go_to_pay));

    mTvEdit.setOnClickListener(this);
    mCheckBoxAll.setOnClickListener(this);
    mBtnSubmit.setOnClickListener(this);

    mTvTitle.setText(getString(R.string.cart, 0));
    mBtnSubmit.setText(getString(R.string.go_settle_X, 0));
    mTvTotal.setText(getString(R.string.rmb_X, 0.00));

    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    mAdapter = new MainAdapter(this, getData());
    mAdapter.setOnCheckChangeListener(new CartOnCheckChangeListener(recyclerView, mAdapter) {
        @Override
        public void onCalculateChanged(ICartItem cartItemBean) {
            calculate();
        }
    });
    recyclerView.setAdapter(mAdapter);

    // 给列表注册 ContextMenu 事件。
    // 同时如果想让ItemView响应长按弹出菜单,需要在item xml布局中设置 android:longClickable="true"
    registerForContextMenu(recyclerView);
}
 
源代码16 项目: xDrip-plus   文件: Reminders.java
private void maskAlternatingCheckbox(boolean state, CheckBox alternatingCheck) {
    if (state) {
        alternatingCheck.setEnabled(true);
    } else {
        alternatingCheck.setEnabled(false);
        alternatingCheck.setChecked(false);
    }
}
 
源代码17 项目: commcare-android   文件: ListMultiWidget.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();
    for (CheckBox c : mCheckboxes) {
        c.cancelLongPress();
    }
}
 
源代码18 项目: coolreader   文件: DisplayOriginalListActivity.java
@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
	switch (item.getItemId()) {
	case R.id.add_to_watch:
		/*
		 * Implement code to toggle watch of this novel
		 */
		CheckBox checkBox = (CheckBox) findViewById(R.id.novel_is_watched);
		if (checkBox.isChecked()) {
			checkBox.setChecked(false);
		} else {
			checkBox.setChecked(true);
		}
		return true;
	case R.id.download_novel:
		/*
		 * Implement code to download novel synopsis
		 */
		AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
		if (info.position > -1) {
			PageModel novel = listItems.get(info.position);
			ArrayList<PageModel> novels = new ArrayList<PageModel>();
			novels.add(novel);
			touchedForDownload = novel.getTitle() + "'s information";
			executeDownloadTask(novels);
		}
		return true;
	default:
		return super.onContextItemSelected(item);
	}
}
 
源代码19 项目: sana.mobile   文件: EncounterListFragment.java
/**
 * All checkboxes will be checked
 */
public void selectAllProcedures() {
    for (int x = 0; x < getListAdapter().getCount(); x++) {
        try {
            CheckBox checkbox = (CheckBox) getListView().getChildAt(x)
                    .findViewById(R.id.checkbox);
            checkbox.setChecked(true);
            Log.i(TAG, "....Is checkbox checked? (Should be true): "
                    + checkbox.isChecked());
        } catch (Exception e) {
            e.printStackTrace();
            Log.e(TAG, "Exception in selectAll(): pos: " + x + " ," + e.getMessage());
        }
    }
}
 
源代码20 项目: grafika   文件: HardwareScalerActivity.java
/**
 * Updates the on-screen controls to reflect the current state of the app.
 */
private void updateControls() {
    configureRadioButton(R.id.surfaceSizeTiny_radio, SURFACE_SIZE_TINY);
    configureRadioButton(R.id.surfaceSizeSmall_radio, SURFACE_SIZE_SMALL);
    configureRadioButton(R.id.surfaceSizeMedium_radio, SURFACE_SIZE_MEDIUM);
    configureRadioButton(R.id.surfaceSizeFull_radio, SURFACE_SIZE_FULL);

    TextView tv = (TextView) findViewById(R.id.viewSizeValue_text);
    tv.setText(mFullViewWidth + "x" + mFullViewHeight);

    CheckBox cb = (CheckBox) findViewById(R.id.flatShading_checkbox);
    cb.setChecked(mFlatShadingChecked);
}
 
源代码21 项目: Focus   文件: CollectionFolderListAdapter.java
private void initListener(){
    this.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            click(view,position,((CheckBox)(view.findViewById(R.id.select))).isChecked());
        }
    });
}
 
源代码22 项目: BotLibre   文件: EditBotActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_edit_bot);

	resetView();
	
	InstanceConfig instance = (InstanceConfig)MainActivity.instance;
	
	CheckBox checkbox = (CheckBox) findViewById(R.id.forkingCheckBox);
	checkbox.setChecked(instance.allowForking);
}
 
ViewHolder(@NonNull View view) {
    super(view);
    collectionNameTextView = view.findViewById(R.id.title);
    checkBox = view.findViewById(R.id.checkbox);
    checkBox.setOnClickListener(v ->
            bookCollectionInfo
                    .setBelongToCollection(
                            booksCollection,
                            ((CheckBox) v).isChecked()));
}
 
源代码24 项目: FimiX8-RE   文件: X8AiTtipodConfirmUi.java
public void initViews(View rootView) {
    this.imgReturn = rootView.findViewById(R.id.img_ai_follow_return);
    this.btnOk = rootView.findViewById(R.id.btn_ai_follow_confirm_ok);
    this.cbTip = (CheckBox) rootView.findViewById(R.id.cb_ai_follow_confirm_ok);
    this.imgFlag = (ImageView) rootView.findViewById(R.id.img_ttipod_flag);
    this.imgFlag.setImageBitmap(ImageUtils.getBitmapByPath(rootView.getContext(), R.drawable.x8_img_ttipod_flag));
}
 
@Override
public void onBindViewHolder(final ContactRecyclerViewAdapter.ViewHolder holder, int position) {
    final Contact contact = contacts.get(holder.getAdapterPosition());
    holder.name.setText(contact.getName());

    holder.numbers.removeAllViews();
    Iterator<String> iterator = contact.getPhoneNumbers().iterator();
    while (iterator.hasNext()) {
        final String number = iterator.next();

        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(LinearLayout.HORIZONTAL);
        CheckBox checkBox = new CheckBox(context);
        checkBox.setTag(number);

        checkBox.setOnTouchListener(checkBoxInteractionListener);
        checkBox.setOnCheckedChangeListener(checkBoxInteractionListener);

        TextView phoneNumber = new TextView(context);
        phoneNumber.setText(number);

        linearLayout.addView(checkBox);
        linearLayout.addView(phoneNumber);

        holder.numbers.addView(linearLayout);
    }

    if (holder.getAdapterPosition() == getItemCount() - 1) {
        holder.footer.setVisibility(View.VISIBLE);
    } else {
        holder.footer.setVisibility(View.GONE);
    }
}
 
private void initView() {
	etName = (EditText) findViewById(R.id.etName);
	btnGetCode = (Button) findViewById(R.id.btnGetCode);
	etCode = (EditText) findViewById(R.id.etCode);
	etPsw = (EditText) findViewById(R.id.etPsw);
	btnRrgister = (Button) findViewById(R.id.btnRrgister);
	cbLaws = (CheckBox) findViewById(R.id.cbLaws);

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

}
 
源代码27 项目: open   文件: LoginAdapterTest.java
@Test
public void instantiateItem_loginButtonShouldSendMixpanelEvent() throws Exception {
    TestLoginListener listener = new TestLoginListener();
    loginAdapter.setLoginListener(listener);
    View view = (View) loginAdapter.instantiateItem(new FrameLayout(application), PAGE_4);
    Button loginButton = (Button) view.findViewById(R.id.login_button);
    CheckBox checkbox = (CheckBox) view.findViewById(R.id.agree);
    checkbox.setEnabled(true);
    loginButton.performClick();
    assertThat(listener.login).isFalse();
}
 
源代码28 项目: FimiX8-RE   文件: X8AiHeadingLockConfirmUi.java
public void initViews(View rootView) {
    this.imgReturn = rootView.findViewById(R.id.img_ai_follow_return);
    this.btnOk = (Button) rootView.findViewById(R.id.btn_ai_follow_confirm_ok);
    this.isCourse = X8AiConfig.getInstance().isAiHeadingLock();
    this.vCourse = rootView.findViewById(R.id.rl_head_lock_course);
    this.vAngle = rootView.findViewById(R.id.rl_head_lock_setangle);
    this.tvAngle = (TextView) rootView.findViewById(R.id.tv_lock_angle);
    this.prex = rootView.getContext().getString(R.string.x8_ai_heading_lock_tip3);
    this.imgFlag = (ImageView) rootView.findViewById(R.id.img_heading_lock_flag);
    this.imgLockBg = (ImageView) rootView.findViewById(R.id.img_lock_bg);
    this.imgLockAngle = (ImageView) rootView.findViewById(R.id.img_lock_angle);
    this.imgLockBg.setImageBitmap(ImageUtils.getBitmapByPath(rootView.getContext(), R.drawable.x8_img_head_lock_bg));
    this.imgLockAngle.setImageBitmap(ImageUtils.getBitmapByPath(rootView.getContext(), R.drawable.x8_img_head_lock_arrow));
    if (this.isCourse) {
        this.vCourse.setVisibility(0);
        this.vAngle.setVisibility(8);
        this.btnOk.setText(rootView.getContext().getString(R.string.x8_ai_fly_follow_ok));
        this.cbTip = (CheckBox) rootView.findViewById(R.id.cb_ai_follow_confirm_ok);
        this.imgFlag.setImageBitmap(ImageUtils.getBitmapByPath(rootView.getContext(), R.drawable.x8_img_heading_lock_flag));
        return;
    }
    this.vCourse.setVisibility(8);
    this.vAngle.setVisibility(0);
    this.btnOk.setText(rootView.getContext().getString(R.string.x8_ai_fly_follow_go));
    float angle = StateManager.getInstance().getX8Drone().getFcSportState().getDeviceAngle();
    this.tvAngle.setText(String.format(this.prex, new Object[]{Float.valueOf(angle)}));
    this.imgLockAngle.setRotation(angle);
}
 
源代码29 项目: FimiX8-RE   文件: X8AiPoint2PointConfirmUi.java
public void initViews(View rootView) {
    this.imgReturn = rootView.findViewById(R.id.img_ai_follow_return);
    this.btnOk = rootView.findViewById(R.id.btn_ai_follow_confirm_ok);
    this.cbTip = (CheckBox) rootView.findViewById(R.id.cb_ai_follow_confirm_ok);
    this.imgFlag = (ImageView) rootView.findViewById(R.id.img_device_to_point_flag);
    this.imgFlag.setImageBitmap(ImageUtils.getBitmapByPath(rootView.getContext(), R.drawable.x8_img_device_to_point_flag));
}
 
源代码30 项目: fdroidclient   文件: SwapWorkflowActivity.java
private void setUpNfcView() {
    CheckBox dontShowAgain = container.findViewById(R.id.checkbox_dont_show);
    dontShowAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Preferences.get().setShowNfcDuringSwap(!isChecked);
        }
    });

}
 
 类所在包
 同包方法