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: 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 #2
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 #3
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 #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: 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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
Source File: MainActivity.java    From CartLayout with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #16
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void maskAlternatingCheckbox(boolean state, CheckBox alternatingCheck) {
    if (state) {
        alternatingCheck.setEnabled(true);
    } else {
        alternatingCheck.setEnabled(false);
        alternatingCheck.setChecked(false);
    }
}
 
Example #17
Source File: ListMultiWidget.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@Override
public void cancelLongPress() {
    super.cancelLongPress();
    for (CheckBox c : mCheckboxes) {
        c.cancelLongPress();
    }
}
 
Example #18
Source File: DisplayOriginalListActivity.java    From coolreader with MIT License 5 votes vote down vote up
@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);
	}
}
 
Example #19
Source File: EncounterListFragment.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * 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());
        }
    }
}
 
Example #20
Source File: HardwareScalerActivity.java    From grafika with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: CollectionFolderListAdapter.java    From Focus with GNU General Public License v3.0 5 votes vote down vote up
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());
        }
    });
}
 
Example #22
Source File: EditBotActivity.java    From BotLibre with Eclipse Public License 1.0 5 votes vote down vote up
@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);
}
 
Example #23
Source File: BookCollectionRecyclerViewAdapter.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
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()));
}
 
Example #24
Source File: X8AiTtipodConfirmUi.java    From FimiX8-RE with MIT License 5 votes vote down vote up
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));
}
 
Example #25
Source File: ContactRecyclerViewAdapter.java    From PowerSwitch_Android with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example #26
Source File: GosRegisterUserActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
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());

}
 
Example #27
Source File: LoginAdapterTest.java    From open with GNU General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example #28
Source File: X8AiHeadingLockConfirmUi.java    From FimiX8-RE with MIT License 5 votes vote down vote up
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);
}
 
Example #29
Source File: X8AiPoint2PointConfirmUi.java    From FimiX8-RE with MIT License 5 votes vote down vote up
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));
}
 
Example #30
Source File: SwapWorkflowActivity.java    From fdroidclient with GNU General Public License v3.0 5 votes vote down vote up
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);
        }
    });

}