protected void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) { hideKeyboard(); AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header); AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc); AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img); if (error) { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close"); } else { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok"); } infoHeader.setText(header); infoDesc.setText(desc); if (drawable != null) infoImg.setImageDrawable(drawable); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }
public AbsStepHolder(ViewGroup parent, int internalLayoutRes, int stepIndex) { super(createVerticalMainHolderView(parent)); this.index = stepIndex; this.counterRoot = itemView.findViewById(R.id.counter_root); this.counterText = (TextView) itemView.findViewById(R.id.counter); this.titleText = (TextView) itemView.findViewById(R.id.title); this.line = itemView.findViewById(R.id.step_line); this.buttonNext = (AppCompatButton) itemView.findViewById(R.id.buttonNext); this.buttonCancel = (Button) itemView.findViewById(R.id.buttonCancel); this.content = (ViewGroup) itemView.findViewById(R.id.content); this.contentRoot = itemView.findViewById(R.id.content_root); this.mContentView = LayoutInflater.from(itemView.getContext()).inflate(internalLayoutRes, parent, false); this.content.addView(mContentView); initInternalView(mContentView); }
private void setupConfirmButton() { AppCompatButton button = (AppCompatButton) mViewDetails.findViewById(R.id.confirmButton); String issueUserToken = mIssue.getUserAuthToken(); String userToken = UserAdapter.getCurrentUser().getUserAuthToken(); if (issueUserToken.equals(userToken)) { button.setAlpha(DISABLED_ALPHA); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Snackbar.make(getView(), R.string.cant_confirm_own_issue, Snackbar.LENGTH_SHORT) .show(); } }); } else { if (mIssue.getConfirmedByAuthUser()) { changeButtonStyle(button, IssueButton.UNCONFIRM); } IssueButtonListener buttonListener = new IssueButtonListener(this, mViewDetails, mIssue, IssueButton.CONFIRM, IssueButton.UNCONFIRM); button.setOnClickListener(buttonListener); } }
private void setupReportButton() { AppCompatButton button = (AppCompatButton) mViewDetails.findViewById(R.id.reportButton); String issueUserToken = mIssue.getUserAuthToken(); String userToken = UserAdapter.getCurrentUser().getUserAuthToken(); if (issueUserToken.equals(userToken)) { button.setAlpha(DISABLED_ALPHA); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Snackbar.make(getView(), R.string.cant_report_own_issue, Snackbar.LENGTH_SHORT) .show(); } }); } else { if (mIssue.getReportedByAuthUser()) { changeButtonStyle(button, IssueButton.UNREPORT); } IssueButtonListener buttonListener = new IssueButtonListener(this, mViewDetails, mIssue, IssueButton.REPORT, IssueButton.UNREPORT); button.setOnClickListener(buttonListener); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mBlogin = (AppCompatButton) findViewById(R.id.bsignin); mBlogin.setOnClickListener(mListen); mUser = (EditText) findViewById(R.id.login_email_input); mPassw = (EditText) findViewById(R.id.login_password_input); mPassforgot = (TextView) findViewById(R.id.login_forgot); mIconFirstCredential = (ImageView) findViewById(R.id.email_errors_icon); mMessageFirstCredential = (TextView) findViewById(R.id.email_errors_text); mIconPassword = (ImageView) findViewById(R.id.password_errors_icon); mMessagePassword = (TextView) findViewById(R.id.password_errors_text); mPassforgot.setOnClickListener(mListen); mLoginAdapter = AdapterFactory.getInstance().getLoginAdapter(this); }
/** * This method is to initialize views */ private void initViews() { nestedScrollView = (NestedScrollView) findViewById(R.id.nestedScrollView); textInputLayoutName = (TextInputLayout) findViewById(R.id.textInputLayoutName); textInputLayoutEmail = (TextInputLayout) findViewById(R.id.textInputLayoutEmail); textInputLayoutPassword = (TextInputLayout) findViewById(R.id.textInputLayoutPassword); textInputLayoutConfirmPassword = (TextInputLayout) findViewById(R.id.textInputLayoutConfirmPassword); textInputEditTextName = (TextInputEditText) findViewById(R.id.textInputEditTextName); textInputEditTextEmail = (TextInputEditText) findViewById(R.id.textInputEditTextEmail); textInputEditTextPassword = (TextInputEditText) findViewById(R.id.textInputEditTextPassword); textInputEditTextConfirmPassword = (TextInputEditText) findViewById(R.id.textInputEditTextConfirmPassword); appCompatButtonRegister = (AppCompatButton) findViewById(R.id.appCompatButtonRegister); appCompatTextViewLoginLink = (AppCompatTextView) findViewById(R.id.appCompatTextViewLoginLink); }
private void showInfo(String header, String desc, @Nullable Drawable drawable, boolean error) { hideKeyboard(); AppCompatTextView infoHeader = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_header); AppCompatTextView infoDesc = (AppCompatTextView) llBottomSheet.findViewById(R.id.info_desc); AppCompatImageView infoImg = (AppCompatImageView) llBottomSheet.findViewById(R.id.info_img); if (error) { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.GONE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Close"); } else { llBottomSheet.findViewById(R.id.info_img).setVisibility(View.VISIBLE); ((AppCompatButton) findViewById(R.id.ok_dimiss)).setText("Ok"); } infoHeader.setText(header); infoDesc.setText(desc); if (drawable != null) infoImg.setImageDrawable(drawable); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnCard = (AppCompatButton) findViewById(R.id.btn_card); btnLayout = (AppCompatButton) findViewById(R.id.btn_layout); btnLayoutBlur = (AppCompatButton) findViewById(R.id.btn_layout_blur); btnLayoutMove = (AppCompatButton) findViewById(R.id.btn_layout_move); btnLayoutScale = (AppCompatButton) findViewById(R.id.btn_layout_scale); btnLayoutCrossMove = (AppCompatButton) findViewById(R.id.btn_layout_cross); btnCard.setOnClickListener(this); btnLayout.setOnClickListener(this); btnLayoutBlur.setOnClickListener(this); btnLayoutMove.setOnClickListener(this); btnLayoutScale.setOnClickListener(this); btnLayoutCrossMove.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_delete); Toolbar toolbar = (Toolbar) findViewById(R.id.app_bar); setSupportActionBar(toolbar); editText = (EditText) findViewById(R.id.editText); textInputLayout = (TextInputLayout) findViewById(R.id.textInputLayout); if(getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } AppCompatButton appCompatButton = (AppCompatButton) findViewById(R.id.button); appCompatButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { delete(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); editText = (EditText) findViewById(R.id.editText); spinner = (Spinner) findViewById(R.id.spinner); textInputLayout = (TextInputLayout) findViewById(R.id.textInputLayout); ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.countries, R.layout.spinner_layout); arrayAdapter.setDropDownViewResource(R.layout.spinner_layout); spinner.setAdapter(arrayAdapter); AppCompatButton appCompatButton = (AppCompatButton) findViewById(R.id.button); appCompatButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { register(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //find view sample1Btn = (AppCompatButton) findViewById(R.id.sample1Btn); sample2Btn = (AppCompatButton) findViewById(R.id.sample2Btn); sample3Btn = (AppCompatButton) findViewById(R.id.sample3Btn); sample4Btn = (AppCompatButton) findViewById(R.id.sample4Btn); sample5Btn = (AppCompatButton) findViewById(R.id.sample5Btn); //set on click listener for buttons sample1Btn.setOnClickListener(this); sample2Btn.setOnClickListener(this); sample3Btn.setOnClickListener(this); sample4Btn.setOnClickListener(this); sample5Btn.setOnClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMainApplication = (MainApplication) getApplication(); mAuthorize = (AppCompatButton) findViewById(R.id.authorize); mMakeApiCall = (AppCompatButton) findViewById(R.id.makeApiCall); mSignOut = (AppCompatButton) findViewById(R.id.signOut); mGivenName = (AppCompatTextView) findViewById(R.id.givenName); mFamilyName = (AppCompatTextView) findViewById(R.id.familyName); mFullName = (AppCompatTextView) findViewById(R.id.fullName); mProfileView = (ImageView) findViewById(R.id.profileImage); enablePostAuthorizationFlows(); // wire click listeners mAuthorize.setOnClickListener(new AuthorizeListener(this)); // Retrieve app restrictions and take appropriate action getAppRestrictions(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMainApplication = (MainApplication) getApplication(); mAuthorize = (AppCompatButton) findViewById(R.id.authorize); mMakeApiCall = (AppCompatButton) findViewById(R.id.makeApiCall); mSignOut = (AppCompatButton) findViewById(R.id.signOut); mGivenName = (AppCompatTextView) findViewById(R.id.givenName); mFamilyName = (AppCompatTextView) findViewById(R.id.familyName); mFullName = (AppCompatTextView) findViewById(R.id.fullName); mProfileView = (ImageView) findViewById(R.id.profileImage); enablePostAuthorizationFlows(); // wire click listeners mAuthorize.setOnClickListener(new AuthorizeListener()); }
@Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.login); context = LoginActivity.this; pDialog = new ProgressDialog(context); editTextEmail = (EditText) findViewById(R.id.editTextEmail); editTextPassword = (EditText) findViewById(R.id.editTextPassword); buttonLogin = (AppCompatButton) findViewById(R.id.buttonLogin); buttonLogin.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ login(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); voiceView = (UcVoiceView) findViewById(R.id.ucVoice); start = (AppCompatButton) findViewById(R.id.start); start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(!visible){ voiceView.showVoice(); }else{ voiceView.hideVoice(); } visible = !visible; } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_login, container, false); loginName = (AppCompatEditText) view.findViewById(R.id.login_name); loginPassword = (AppCompatEditText) view.findViewById(R.id.login_password); AppCompatButton signInButton = (AppCompatButton) view.findViewById(R.id.sign_in_button); signInButton.setOnClickListener(__ -> { if (isInputDataValid()) { String name = loginName.getText().toString(); String password = loginPassword.getText().toString(); mPresenter.saveUser(name, password); mPresenter.attemptLogin(name, password, false); } else { showInputDataError(); } }); return view; }
protected void setUpStepLayoutAsConfirmationStepLayout(LinearLayout stepLayout) { LinearLayout stepLeftLine = (LinearLayout) stepLayout.findViewById(R.id.vertical_line); LinearLayout stepLeftLine2 = (LinearLayout) stepLayout.findViewById(R.id.vertical_line_subtitle); confirmationButton = (AppCompatButton) stepLayout.findViewById(R.id.next_step); stepLeftLine.setVisibility(View.INVISIBLE); stepLeftLine2.setVisibility(View.INVISIBLE); disableConfirmationButton(); confirmationButton.setText(R.string.vertical_form_stepper_form_confirm_button); confirmationButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { prepareSendingAndSend(); } }); // Some content could be added to the final step inside stepContent layout // RelativeLayout stepContent = (RelativeLayout) stepLayout.findViewById(R.id.step_content); }
protected void setButtonColor(AppCompatButton button, int buttonColor, int buttonTextColor, int buttonPressedColor, int buttonPressedTextColor) { int[][] states = new int[][]{ new int[]{android.R.attr.state_pressed}, new int[]{android.R.attr.state_focused}, new int[]{} }; ColorStateList buttonColours = new ColorStateList( states, new int[]{ buttonPressedColor, buttonPressedColor, buttonColor }); ColorStateList buttonTextColours = new ColorStateList( states, new int[]{ buttonPressedTextColor, buttonPressedTextColor, buttonTextColor }); button.setSupportBackgroundTintList(buttonColours); button.setTextColor(buttonTextColours); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activityComponent().inject(this); mPresenter.attachView(this); mPresenter.getRiderProfile(getIntent().getStringExtra(EMAIL)); horseList = (ListView) findViewById(R.id.horses_list); horseList.setOnItemClickListener((adapterView, view, i, l) -> onHorseSelected(i)); horseList.setOnItemLongClickListener((adapterView, view, i, l) -> onHorseLongClicked(i)); TextView emptyList = (TextView) findViewById(R.id.empty_horse_list); emptyList.setOnClickListener(view -> emptyHorseListClicked()); AppCompatButton skillTreeButton = (AppCompatButton) findViewById(R.id.button_skill_tree); skillTreeButton.setOnClickListener(view -> openSkillTree()); AppCompatButton addHorseButton = (AppCompatButton) findViewById(R.id.add_horse_button); addHorseButton.setOnClickListener(view -> addHorseClicked()); viewFlipperHorse = (ViewFlipper) findViewById(R.id.owned_horses_view_flipper); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_hnr); setSupportActionBar(toolbar); toolbar.setTitle(riderProfile.getName()); setupToolbar(toolbar); setUpNavigationDrawer(); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample_rx); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(getString(R.string.example_rx2)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Initialize Presenter presenter = new Sample4Presenter(); // Attach View to it presenter.attachView(this); // FindViewByIds, ClickListeners textView = (TextView) findViewById(R.id.text_sampleRx_list); AppCompatButton buttonGenerate = (AppCompatButton) findViewById(R.id.button_sampleRx_generate); buttonGenerate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Call Presenter Method presenter.createList(); } }); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample_rx); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(getString(R.string.example_rx1)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Initialize Presenter presenter = new Sample3Presenter(); // Attach View to it presenter.attachView(this); // FindViewByIds, ClickListeners textView = (TextView) findViewById(R.id.text_sampleRx_list); AppCompatButton buttonGenerate = (AppCompatButton) findViewById(R.id.button_sampleRx_generate); buttonGenerate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Call Presenter Method presenter.createList(); } }); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample_rx); if (getSupportActionBar() != null) { getSupportActionBar().setTitle(getString(R.string.example_null_view_rx1)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } // Initialize Presenter presenter = new Sample7Presenter(Sample7Contract.View.class); // Attach View to it presenter.attachView(this); // FindViewByIds, ClickListeners textView = (TextView) findViewById(R.id.text_sampleRx_list); AppCompatButton buttonGenerate = (AppCompatButton) findViewById(R.id.button_sampleRx_generate); buttonGenerate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Call Presenter Method presenter.createList(); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int page = getArguments().getInt(ARG_SECTION_NUMBER); View rootView = inflater.inflate(R.layout.fragment_onboarding, container, false); ImageView image = (ImageView) rootView.findViewById(R.id.sectionImage); image.setImageResource(getImageForBrowser(page, 1)); TextView titleView = (TextView) rootView.findViewById(R.id.sectionTitle); titleView.setText(getTitleForPage(page)); TextView textView = (TextView) rootView.findViewById(R.id.sectionMessage); textView.setText(getTextForPage(page)); AppCompatButton button = (AppCompatButton) rootView.findViewById(R.id.sectionButton); button.setText(getButtonTextForPage(page)); button.setOnClickListener(listener); return rootView; }
@VisibleForTesting void initSteps(@Nullable SavedState savedState) { ContextThemeWrapper contextWrapper = new ContextThemeWrapper(context, continueButtonStyle); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { Step.State initialState = savedState != null ? savedState.stepStates.get(i) : null; Step step = new Step(getChildAt(i), new InternalTouchView(context), new AppCompatButton(contextWrapper, null, 0), commonStepValues, initialState); steps.add(step); } for (Step s : steps) { initTouchView(s); initNavButtons(s); syncVisibilityWithActiveState(s); } }
@VisibleForTesting int calculateMaxStepWidth() { int width = 0; for (int i = 0, innerViewsSize = steps.size(); i < innerViewsSize; i++) { Step step = steps.get(i); width = Math.max(width, step.calculateStepDecoratorWidth()); View innerView = step.getInnerView(); int innerViewHorizontalPadding = step.calculateHorizontalUsedSpace(innerView); width = Math.max(width, innerView.getMeasuredWidth() + innerViewHorizontalPadding); AppCompatButton continueButton = step.getContinueButton(); int continueHorizontalPadding = step.calculateHorizontalUsedSpace(continueButton); width = Math.max(width, continueButton.getMeasuredWidth() + continueHorizontalPadding); } return width; }
MockedStep() { innerView = mock(View.class); innerLayoutParams = mock(VerticalStepper.LayoutParams.class); when(innerView.getLayoutParams()).thenReturn(innerLayoutParams); continueButton = mock(AppCompatButton.class); continueLayoutParams = mock(VerticalStepper.LayoutParams.class); when(continueButton.getLayoutParams()).thenReturn(continueLayoutParams); touchView = mock(VerticalStepper.InternalTouchView.class); step = mock(Step.class); when(step.getInnerView()).thenReturn(innerView); when(step.getTouchView()).thenReturn(touchView); when(step.getContinueButton()).thenReturn(continueButton); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(com.hybrid.freeopensourceusers.R.layout.activity_register); myApplication = MyApplication.getInstance(); volleySingleton = VolleySingleton.getInstance(); requestQueue = volleySingleton.getRequestQueue(); sharedPrefManager = new SharedPrefManager(this); circleImageView = (CircleImageView) findViewById(R.id.userProfile); changeProfile = (AppCompatButton) findViewById(R.id.btn_change); input_nameRegister = (EditText) findViewById(R.id.input_nameRegister); input_emailRegister = (EditText) findViewById(R.id.input_emailRegister); input_passwordRegister = (EditText) findViewById(R.id.input_passwordRegister); input_retypepasswordRegister = (EditText) findViewById(R.id.input_retypepasswordRegister); changeProfile.setOnClickListener(this); mExecutor = Executors.newSingleThreadExecutor(); final Uri uri = getIntent().getData(); if(uri != null) mExecutor.submit(new RegisterActivity.LoadScaledImageTask(this, uri, circleImageView, calcImageSize())); }
@Override protected View onCreateView(Activity activity, Object... args) { mAdapter = new CommentLlvAdapter(); View contentView = activity.getLayoutInflater().inflate(R.layout.view_poi_detail_comment, null); LinearLayout rootDiv = (LinearLayout) contentView.findViewById(R.id.llRootDiv); mScoreWidget = new CommentScoresWidget(getActivity()); rootDiv.addView(mScoreWidget.getContentView(), 0); mLinearLv = (LinearListView) contentView.findViewById(R.id.linearLv); mAcbSeeAll = (AppCompatButton) contentView.findViewById(R.id.acbSeeAll); mAcbSeeAll.setOnClickListener(this); return contentView; }
@Override protected void initContentView() { mSdvPhoto = (FrescoIv) findViewById(R.id.sdvPhoto); mTvTitle = (TextView) findViewById(R.id.tvTitle); mEtName = (EditText) findViewById(R.id.etName); mEtPhone = (EditText) findViewById(R.id.etPhone); mEtEmail = (EditText) findViewById(R.id.etEmail); mTvPrice = (TextView) findViewById(R.id.tvTotalPrice); mAcbNext = (AppCompatButton) findViewById(R.id.acbNext); mAcbNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { checkProfileThenSubmit(); } }); mSdvPhoto.setImageURI(mPhotoUrl); mTvTitle.setText(mTitle); mTvPrice.setText(JTextSpanUtil.getFormatUnitStr(mTotalPrice)); }
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); final View rootView = inflater.inflate(R.layout.fragment_main, container, false); this.mButtonStartInterstitial = (AppCompatButton) rootView.findViewById(R.id.buttonStartInterstitial); this.mButtonStartInterstitial.setOnClickListener(this.mOnClickListener); this.mAdView = (AdView) rootView.findViewById(R.id.adView); this.mAdView.setAdListener(this.mAdListener); this.mAdView.loadAd(new AdRequest.Builder().build()); this.mInterstitialAd = new InterstitialAd(this.getActivity()); this.mInterstitialAd.setAdUnitId(this.getString(R.string.app_ad)); this.mInterstitialAd.setAdListener(this.mAdListener); this.mInterstitialAd.loadAd(new AdRequest.Builder().build()); return rootView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { PasscodeItem item = getItem(position); if(convertView == null || convertView.getTag() != PasscodeItem.class){ convertView = inflater.inflate(R.layout.button_passcode_custom, parent, false); convertView.setTag(PasscodeItem.class); } AppCompatButton button = (AppCompatButton) convertView; button.setText(item.getValue()); button.setVisibility(item.getType() == PasscodeItem.TYPE_EMPTY ? View.INVISIBLE : View.VISIBLE); return convertView; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_free_response); vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); question = getIntent().getParcelableExtra("question"); answer = (EditText) findViewById(R.id.response); timeRemaining = (TimerView) findViewById(R.id.timeRemaining); content = (LinearLayout) findViewById(R.id.content); root = (LinearLayout) findViewById(R.id.root); submit = (AppCompatButton) findViewById(R.id.submit); questionText = (TextView) findViewById(R.id.question); submit.setOnClickListener(this); setQuestion(question); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_numeric_response); vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); question = getIntent().getParcelableExtra("question"); response = (EditText) findViewById(R.id.response); numpad = (DecimalInputView) findViewById(R.id.numpad); timeRemaining = (TimerView) findViewById(R.id.timeRemaining); root = (LinearLayout) findViewById(R.id.root); content = (LinearLayout) findViewById(R.id.content); submit = (AppCompatButton) findViewById(R.id.submit); questionText = (TextView) findViewById(R.id.question); InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(response.getWindowToken(), 0); submit.setOnClickListener(this); if (question != null) { setQuestion(question); } }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compat_button_layout); this.btncompat = (AppCompatButton) findViewById(R.id.btn_compat); this.btncompat.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ColorStateList lists = getResources().getColorStateList(android.R.color.holo_red_light); ViewCompat.setBackgroundTintList(btncompat, lists); ViewCompat.setBackgroundTintMode(btncompat, PorterDuff.Mode.SRC_IN); } }); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fl = inflater.inflate(R.layout.fragment_first, container, false); button = (AppCompatButton) fl.findViewById(R.id.button); button.setOnClickListener(this); textView1 = (AppCompatTextView) fl.findViewById(R.id.textView1); textView1.setText(mParam1); textView2 = (AppCompatTextView) fl.findViewById(R.id.textView2); textView2.setText(mParam2); // Inflate the layout for this fragment return fl; }
public void setButtonState(View button, boolean selected) { if (button == null) { return; } button.setSelected(selected); button.setBackgroundResource(selected ? R.drawable.button_pressed : R.drawable.button_not_pressed); if (colorPressed != 0 || colorNotPressed != 0) { button.setBackgroundColor(selected ? colorPressed : colorNotPressed); } else if (colorPressedBackground != 0 || colorNotPressedBackground != 0) { button.setBackgroundColor(selected ? colorPressedBackground : colorNotPressedBackground); } if (button instanceof Button) { int style = selected ? R.style.WhiteBoldText : R.style.PrimaryNormalText; ((AppCompatButton) button).setTextAppearance(this.getContext(), style); if (colorPressed != 0 || colorNotPressed != 0) { ((AppCompatButton) button).setTextColor(!selected ? colorPressed : colorNotPressed); } if (colorPressedText != 0 || colorNotPressedText != 0) { ((AppCompatButton) button).setTextColor(selected ? colorPressedText : colorNotPressedText); } if (pressedBackgroundResource != 0 || notPressedBackgroundResource != 0) { button.setBackgroundResource(selected ? pressedBackgroundResource : notPressedBackgroundResource); } } }
private void includeDescriptionsButton() { View inputView = toInputView(); ViewGroup parent = (ViewGroup) inputView.getParent(); if (parent == null) return; if (parent.findViewWithTag(DESCRIPTION_BUTTON_TAG) == null) { Button button = new AppCompatButton(context); button.setTextAppearance(context, android.R.style.TextAppearance_Small); button.setTag(DESCRIPTION_BUTTON_TAG); button.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); button.setText(context.getResources().getString(R.string.label_show_code_descriptions)); button.setBackgroundDrawable(null); button.setPaintFlags(button.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CodeListDescriptionDialogFragment.show(context.getSupportFragmentManager()); } }); int linkColor = new TextView(context).getLinkTextColors().getDefaultColor(); button.setTextColor(linkColor); parent.addView(button); } }
private void includeDescriptionsButton() { View inputView = toInputView(); ViewGroup parent = (ViewGroup) inputView.getParent(); if (parent.findViewWithTag(DESCRIPTION_BUTTON_TAG) == null) { Button button = new AppCompatButton(context); button.setTextAppearance(context, android.R.style.TextAppearance_Small); button.setTag(DESCRIPTION_BUTTON_TAG); button.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); button.setText("Show code descriptions"); button.setBackgroundDrawable(null); button.setPaintFlags(button.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { CodeListDescriptionDialogFragment.show(context.getSupportFragmentManager()); } }); int linkColor = new TextView(context).getLinkTextColors().getDefaultColor(); button.setTextColor(linkColor); parent.addView(button); } }
private Button createNavigationButton() { Button button = new AppCompatButton(context); button.setTextAppearance(context, android.R.style.TextAppearance_Small); button.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); button.setText(context.getResources().getString(R.string.label_navigate)); button.setBackgroundDrawable(null); button.setPaintFlags(button.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { NavigationDialogFragment.show(context.getSupportFragmentManager()); } }); int linkColor = new TextView(context).getLinkTextColors().getDefaultColor(); button.setTextColor(linkColor); return button; }