Java Code Examples for android.support.v7.widget.AppCompatButton#setOnClickListener()
The following examples show how to use
android.support.v7.widget.AppCompatButton#setOnClickListener() .
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: FireSignup.java From Learning-Resources with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lo_fire_auth_signup); mCrdntrlyot = (CoordinatorLayout) findViewById(R.id.cordntrlyot_fireauth_signup); mTxtinptlyotEmail = (TextInputLayout) findViewById(R.id.txtinputlyot_fireauth_signup_email); mTxtinptlyotPaswrd = (TextInputLayout) findViewById(R.id.txtinputlyot_fireauth_signup_password); mTxtinptEtEmail = (TextInputEditText) findViewById(R.id.txtinptet_fireauth_signup_email); mTxtinptEtPaswrd = (TextInputEditText) findViewById(R.id.txtinptet_fireauth_signup_password); mAppcmptbtnSignup = (AppCompatButton) findViewById(R.id.appcmptbtn_fireauth_signup); mTvFrgtPaswrd = (TextView) findViewById(R.id.tv_fireauth_signup_frgtpaswrd); mTvSigninMe = (TextView) findViewById(R.id.tv_fireauth_signup_signinme); mPrgrsbrMain = (ProgressBar) findViewById(R.id.prgrsbr_fireauth_signup); mFireAuth = FirebaseAuth.getInstance(); mFireDB = FirebaseDatabase.getInstance(); mAppcmptbtnSignup.setOnClickListener(this); mTvFrgtPaswrd.setOnClickListener(this); mTvSigninMe.setOnClickListener(this); }
Example 2
Source File: FireResetPassword.java From Learning-Resources with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lo_fire_auth_resetpassword); mCrdntrlyot = (CoordinatorLayout) findViewById(R.id.cordntrlyot_fireauth_resetpaswrd); mTxtinptlyotEmail = (TextInputLayout) findViewById(R.id.txtinputlyot_fireauth_resetpaswrd_email); mTxtinptEtEmail = (TextInputEditText) findViewById(R.id.txtinptet_fireauth_resetpaswrd_email); mAppcmptbtnSignup = (AppCompatButton) findViewById(R.id.appcmptbtn_fireauth_resetpaswrd); mPrgrsbrMain = (ProgressBar) findViewById(R.id.prgrsbr_fireauth_resetpaswrd); mFireAuth = FirebaseAuth.getInstance(); mAppcmptbtnSignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Check all field Validation and call API checkVldtnCallApi(); } }); }
Example 3
Source File: MainActivity.java From appauth-android-codelab with Apache License 2.0 | 6 votes |
@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()); }
Example 4
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings("all") public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_more: ViewGroup rootView = findViewById(R.id.rootView); AppCompatButton button = new AppCompatButton(this); button.setText("动态创建的 Button"); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); rootView.addView(button); break; } return super.onOptionsItemSelected(item); }
Example 5
Source File: MainActivity.java From ZLoading with MIT License | 6 votes |
private void createAllButton(LinearLayout containerLinearLayout) { AppCompatButton button = new AppCompatButton(this); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()); button.setPadding(padding, padding, padding, padding); containerLinearLayout.addView(button, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); button.setText("Show Time"); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, ShowTimeAllActivity.class); startActivity(intent); } }); }
Example 6
Source File: MainActivity.java From Skeleton with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Find view AppCompatButton sampleGradientXmlBtn = findViewById(R.id.sampleGradientXmlBtn); AppCompatButton sampleFadeXml1Btn = findViewById(R.id.sampleFadeXml1Btn); AppCompatButton sampleFadeXml2Btn = findViewById(R.id.sampleFadeXml2Btn); AppCompatButton sampleShapeXmlBtn = findViewById(R.id.sampleShapeXmlBtn); AppCompatButton sampleAutoItemsCountXmlBtn = findViewById(R.id.sampleAutoItemsCountXmlBtn); AppCompatButton sampleGradientJavaBtn = findViewById(R.id.sampleGradientJavaBtn); AppCompatButton sampleAddViewsByJavaBtn = findViewById(R.id.sampleAddViewsByJavaBtn); // Set on click listener for buttons sampleGradientXmlBtn.setOnClickListener(this); sampleFadeXml1Btn.setOnClickListener(this); sampleFadeXml2Btn.setOnClickListener(this); sampleShapeXmlBtn.setOnClickListener(this); sampleAutoItemsCountXmlBtn.setOnClickListener(this); sampleGradientJavaBtn.setOnClickListener(this); sampleAddViewsByJavaBtn.setOnClickListener(this); }
Example 7
Source File: MainActivity.java From ECardFlow with MIT License | 6 votes |
@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); }
Example 8
Source File: LyricsViewFragment.java From QuickLyric with GNU General Public License v3.0 | 5 votes |
@RequiresApi(21) public void showBrokenScrobblingWarning() { if (controllerCallback == null) controllerCallback = new MediaControllerCallback(null); if (NotificationListenerService.isListeningAuthorized(getActivity())) MediaControllerCallback.registerFallbackControllerCallback(getActivity(), controllerCallback); String[] manufacturers = new String[]{"XIAOMI", "HUAWEI", "HONOR", "LETV"}; final boolean canFix = Arrays.asList(manufacturers).contains(Build.BRAND.toUpperCase()); if (canFix && !PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("nls_warning_removed", false)) { final ViewGroup nlsWarning = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.nls_warning, (ViewGroup) getView(), false); AppCompatButton button = nlsWarning.findViewById(R.id.fix_it); button.setText(R.string.fix_it); button.setOnClickListener(view -> { if (!WhiteListUtil.openBootSpecialMenu(getActivity())) { MainActivity.startFeedbackActivity(getActivity(), true); } warningShown = false; removePrompt(nlsWarning, false); }); AppCompatImageButton closeButton = nlsWarning.findViewById(R.id.ic_nls_warning_close); closeButton.setOnClickListener(view -> { removePrompt(nlsWarning, true); PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putBoolean("nls_warning_removed", true).apply(); }); ((ViewGroup) getView()).addView(nlsWarning); warningShown = true; nlsWarning.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (mRefreshLayout.getProgressViewEndOffset() == 0) mRefreshLayout.setProgressViewOffset(true, 0, nlsWarning.getMeasuredHeight()); nlsWarning.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); } }
Example 9
Source File: ColorEditDialog.java From AndroidPhotoshopColorPicker with Artistic License 2.0 | 5 votes |
private void init(Context context){ getWindow().requestFeature(Window.FEATURE_NO_TITLE); setContentView(LayoutInflater.from(context).inflate(R.layout.dialod_edit_color_root, null)); colorEditorRoot=(RelativeLayout)findViewById(R.id.colorEditorRoot); doneButton=(AppCompatButton)findViewById(R.id.doneEditing); cancelButton=(AppCompatButton)findViewById(R.id.cancelEditing); name1=(TextView)findViewById(R.id.name1); name2=(TextView)findViewById(R.id.name2); name3=(TextView)findViewById(R.id.name3); suffix1=(TextView)findViewById(R.id.suffix1); suffix2=(TextView)findViewById(R.id.suffix2); suffix3=(TextView)findViewById(R.id.suffix3); val1=(EditText)findViewById(R.id.val1); val2=(EditText)findViewById(R.id.val2); val3=(EditText)findViewById(R.id.val3); setModeAndValues(MODE_HSV, "", "", "",255); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); }
Example 10
Source File: MainActivity.java From material-intro-screen with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (AppCompatButton) findViewById(R.id.btn_launch_activity); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, IntroActivity.class); startActivity(intent); } }); }
Example 11
Source File: PersonDetail.java From kute with Apache License 2.0 | 5 votes |
private void setupRoutesRow(){ load_routes=new LoadPersonRoutesAsyncTask(this); load_routes.execute(p.id); view_all_routes=(AppCompatButton)findViewById(R.id.viewAllRoutes); view_all_routes.setOnClickListener(this); view_all_routes.setEnabled(false); PlaceHolderFragment loading = new PlaceHolderFragment(); Bundle args = new Bundle(); args.putString("Label", "Loading..."); loading.setArguments(args); getSupportFragmentManager().beginTransaction().replace(R.id.routeFramePersonDetail, loading).commit(); }
Example 12
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 5 votes |
private void initTabHostButton() { AppCompatButton button = findViewById(R.id.tabHostButton); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, TabHostTestActivity.class); startActivity(intent); } }); }
Example 13
Source File: FriendTab.java From kute with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { Log.d(TAG,"onViewCreated"); v=inflater.inflate(R.layout.friend_tab_bottomnavigation,container,false); viewall_currentfriends=(AppCompatButton)v.findViewById(R.id.viewallCurrentfriends); viewall_currentfriends.setEnabled(false); //The button wont be active until and unless we get the entire friendlist viewall_currentfriends.setOnClickListener(this); return v; }
Example 14
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 5 votes |
/** * 普通 setOnClickListener */ private void initButton() { AppCompatButton button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ///还可缓解 showToast("普通"); //hi 就不积跬步 } }); registerForContextMenu(button); }
Example 15
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 5 votes |
private void initShowDialogButton() { AppCompatButton button = findViewById(R.id.showDialogButton); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showDialog(MainActivity.this); } }); }
Example 16
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 5 votes |
private void initAdapterViewTest() { AppCompatButton button = findViewById(R.id.adapterViewTest); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, AdapterViewTestActivity.class); startActivity(intent); } }); }
Example 17
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 5 votes |
private void initExpandableListViewTest() { AppCompatButton button = findViewById(R.id.expandableListViewTest); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, ExpandableListViewTestActivity.class); startActivity(intent); } }); }
Example 18
Source File: MainActivity.java From AutoTrackAppClick6 with Apache License 2.0 | 4 votes |
/** * Lambda 语法 */ private void initLambdaButton() { AppCompatButton button = findViewById(R.id.lambdaButton); button.setOnClickListener(view -> showToast("Lambda OnClick")); }
Example 19
Source File: OnboardingActivity.java From ResearchStack with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.rss_activity_onboarding); ImageView logoView = (ImageView) findViewById(R.id.layout_studyoverview_landing_logo); TextView titleView = (TextView) findViewById(R.id.layout_studyoverview_landing_title); TextView subtitleView = (TextView) findViewById(R.id.layout_studyoverview_landing_subtitle); LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layout_studyoverview_main); StudyOverviewModel model = parseStudyOverviewModel(); // The first item is used for the main activity and not the tabbed dialog StudyOverviewModel.Question welcomeQuestion = model.getQuestions().remove(0); titleView.setText(welcomeQuestion.getTitle()); if (!TextUtils.isEmpty(welcomeQuestion.getDetails())) { subtitleView.setText(welcomeQuestion.getDetails()); } else { subtitleView.setVisibility(View.GONE); } // add Read Consent option to list and tabbed dialog if ("yes".equals(welcomeQuestion.getShowConsent())) { StudyOverviewModel.Question consent = new StudyOverviewModel.Question(); consent.setTitle(getString(R.string.rss_read_consent_doc)); consent.setDetails(ResourceManager.getInstance().getConsentHtml().getName()); model.getQuestions().add(0, consent); } for (int i = 0; i < model.getQuestions().size(); i++) { AppCompatButton button = (AppCompatButton) LayoutInflater.from(this) .inflate(R.layout.rss_button_study_overview, linearLayout, false); button.setText(model.getQuestions().get(i).getTitle()); // set the index for opening the viewpager to the correct page on click button.setTag(i); linearLayout.addView(button); button.setOnClickListener(this); } signUp = (Button) findViewById(R.id.intro_sign_up); signIn = (TextView) findViewById(R.id.intro_sign_in); skip = (Button) findViewById(R.id.intro_skip); skip.setVisibility(UiManager.getInstance().isConsentSkippable() ? View.VISIBLE : View.GONE); int resId = ResUtils.getDrawableResourceId(this, model.getLogoName()); logoView.setImageResource(resId); pagerContainer = findViewById(R.id.pager_container); pagerContainer.setTranslationY(48); pagerContainer.setAlpha(0); pagerContainer.setScaleX(.9f); pagerContainer.setScaleY(.9f); pagerFrame = findViewById(R.id.pager_frame); pagerFrame.setAlpha(0); pagerFrame.setOnClickListener(v -> hidePager()); OnboardingPagerAdapter adapter = new OnboardingPagerAdapter(this, model.getQuestions()); ViewPager pager = (ViewPager) findViewById(R.id.pager); pager.setOffscreenPageLimit(2); pager.setAdapter(adapter); tabStrip = (TabLayout) findViewById(R.id.pager_title_strip); tabStrip.setupWithViewPager(pager); }
Example 20
Source File: FireSignin.java From Learning-Resources with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate())); FacebookSdk.sdkInitialize(getApplicationContext()); mCallbackManager = CallbackManager.Factory.create(); super.onCreate(savedInstanceState); setContentView(R.layout.lo_fire_signin); mCrdntrlyot = (CoordinatorLayout) findViewById(R.id.cordntrlyot_fireauth); mTxtinptlyotEmail = (TextInputLayout) findViewById(R.id.txtinputlyot_fireauth_email); mTxtinptlyotPaswrd = (TextInputLayout) findViewById(R.id.txtinputlyot_fireauth_password); mTxtinptEtEmail = (TextInputEditText) findViewById(R.id.txtinptet_fireauth_email); mTxtinptEtPaswrd = (TextInputEditText) findViewById(R.id.txtinptet_fireauth_password); mAppcmptbtnSignup = (AppCompatButton) findViewById(R.id.appcmptbtn_fireauth_signin); mTvFrgtPaswrd = (TextView) findViewById(R.id.tv_fireauth_frgtpaswrd); mImgvwFirebase = (ImageView) findViewById(R.id.imgvw_fireauth_firebase); mImgvwGp = (ImageView) findViewById(R.id.imgvw_fireauth_social_gp); mImgvwFb = (ImageView) findViewById(R.id.imgvw_fireauth_social_fb); mPrgrsbrMain = (ProgressBar) findViewById(R.id.prgrsbr_fireauth); mFireAuth = FirebaseAuth.getInstance(); mFireDB = FirebaseDatabase.getInstance(); FirebaseAuth.getInstance().signOut(); GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API, gso) .build(); mAppcmptbtnSignup.setOnClickListener(this); mTvFrgtPaswrd.setOnClickListener(this); mImgvwFirebase.setOnClickListener(this); mImgvwGp.setOnClickListener(this); mImgvwFb.setOnClickListener(this); }