android.view.View.OnClickListener Java Examples
The following examples show how to use
android.view.View.OnClickListener.
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: SwitchButton.java From FimiX8-RE with MIT License | 6 votes |
public void setup(AttributeSet attrs) { this.paint = new Paint(1); this.paint.setStyle(Style.STROKE); this.paint.setStrokeCap(Cap.ROUND); this.springSystem = SpringSystem.create(); this.spring = this.springSystem.createSpring(); this.spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50.0d, 7.0d)); setOnClickListener(new OnClickListener() { public void onClick(View arg0) { SwitchButton.this.onViewSwitch(); } }); TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SwitchButton); this.onSpotColor = typedArray.getColor(R.styleable.SwitchButton_onColor, this.onSpotColor); this.offSpotColor = typedArray.getColor(R.styleable.SwitchButton_spotColor, this.offSpotColor); this.toggleOn = typedArray.getBoolean(R.styleable.SwitchButton_onToggle, this.toggleOn); this.spotColor = this.offSpotColor; this.borderWidth = typedArray.getDimensionPixelSize(R.styleable.SwitchButton_borderWidth, (int) AbViewUtil.dip2px(getContext(), (float) this.borderWidth)); this.defaultAnimate = typedArray.getBoolean(R.styleable.SwitchButton_animate, this.defaultAnimate); typedArray.recycle(); }
Example #2
Source File: LoginActivity.java From java-unified-sdk with Apache License 2.0 | 6 votes |
private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; }
Example #3
Source File: HCActivity.java From styT with Apache License 2.0 | 6 votes |
public void showEditTextDialog(Context context, String title, final int itemPosition) { final EditText edit = new EditText(context); //设置只能输入小数 edit.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); edit.setText(items.get(itemPosition).get("delay") + ""); new AlertDialog.Builder(context) .setTitle(title) .setView(edit) .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { // TODO: Implement this method items.get(itemPosition).put("delay", edit.getText().toString()); adapter.notifyDataSetChanged(); } }) .setNegativeButton("取消", null).show(); }
Example #4
Source File: WallWrapperAlertDialogue.java From wallpaper with GNU General Public License v2.0 | 6 votes |
public WallWrapperAlertDialogue buildWithInput(MessageDialogListener listener) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.dialog_vin, null); TextView btn_click = (TextView) view.findViewById(R.id.btn_click); btn_click.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); this.setContentView(view); this.setWidth(LayoutParams.MATCH_PARENT); this.setHeight(LayoutParams.MATCH_PARENT); this.setFocusable(true); ColorDrawable dw = new ColorDrawable(-00000); this.setBackgroundDrawable(dw); this.setOutsideTouchable(false); return this; }
Example #5
Source File: wlflActivity.java From styT with Apache License 2.0 | 6 votes |
public void initViews() { //btMore = (Button) findViewById(R.id.bt_more); lvWifiList = (ListView) findViewById(R.id.lv_wifi_list); etSearch = (EditTextWithDel) findViewById(R.id.et_search); tvNodata = (TextView) findViewById(R.id.tv_nodata); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); // 初始化Toolbar控件 setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); }
Example #6
Source File: LoginActivityA.java From ans-android-sdk with GNU General Public License v3.0 | 6 votes |
private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; }
Example #7
Source File: X9CameraPrensenter.java From FimiX8-RE with MIT License | 6 votes |
private void doPanelTrans(final PanelRecycleViewHolder holder, final int position) { final MediaModel mediaModel = getModel(position); if (mediaModel != null) { holder.tvTitleDescription.setText(getModel(position).getFormatDate()); if (mediaModel.isSelect()) { holder.ivIconSelect.setImageResource(R.drawable.album_btn_category_select_press); holder.tvAllSelect.setText(R.string.media_select_all_no); } else { holder.ivIconSelect.setImageResource(R.drawable.album_btn_category_select_normal); holder.tvAllSelect.setText(R.string.media_select_all); } } holder.rlRightSelect.setOnClickListener(new OnClickListener() { public void onClick(View view) { X9CameraPrensenter.this.onItemCategoryClick(holder, position, mediaModel); } }); }
Example #8
Source File: FJActivity.java From styT with Apache License 2.0 | 6 votes |
@Override protected void onStart() { // TODO: Implement this method super.onStart(); toolbar.setTitle("GIF分解"); // 设置标题 // 设置副标题 toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); }
Example #9
Source File: LocalFragmentPresenter.java From FimiX8-RE with MIT License | 6 votes |
private void doPanelTrans(final PanelRecycleViewHolder holder, final int position) { final MediaModel mediaModel = getModel(position); if (mediaModel != null) { holder.tvTitleDescription.setText(getModel(position).getFormatDate()); if (mediaModel.isSelect()) { holder.ivIconSelect.setImageResource(R.drawable.album_btn_category_select_press); holder.tvAllSelect.setText(R.string.media_select_all_no); } else { holder.ivIconSelect.setImageResource(R.drawable.album_btn_category_select_normal); holder.tvAllSelect.setText(R.string.media_select_all); } } holder.rlRightSelect.setOnClickListener(new OnClickListener() { public void onClick(View view) { LocalFragmentPresenter.this.onItemCategoryClick(holder, position, mediaModel); } }); }
Example #10
Source File: LoginActivity.java From Watch-Me-Build-a-Finance-Startup with MIT License | 6 votes |
private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; }
Example #11
Source File: FilmstripBottomPanel.java From Camera2 with Apache License 2.0 | 6 votes |
private void setupEditButton() { mEditButton = (ImageButton) mLayout.findViewById(R.id.filmstrip_bottom_control_edit); mEditButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mTinyPlanetEnabled) { mController.openContextMenu(mEditButton); } else if (mListener != null) { mListener.onEdit(); } } }); mController.registerForContextMenu(mEditButton); mEditButton.setLongClickable(false); }
Example #12
Source File: HCActivity.java From styT with Apache License 2.0 | 6 votes |
@Override protected void onStart() { // TODO: Implement this method super.onStart(); toolbar.setTitle("GIF合成"); // 设置标题 // 设置副标题 toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); }
Example #13
Source File: WallWrapperAlertDialogue.java From wallpaper with GNU General Public License v2.0 | 6 votes |
public WallWrapperAlertDialogue buildWithInput(MessageDialogListener listener) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.dialog_vin, null); TextView btn_click = (TextView) view.findViewById(R.id.btn_click); btn_click.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); this.setContentView(view); this.setWidth(LayoutParams.MATCH_PARENT); this.setHeight(LayoutParams.MATCH_PARENT); this.setFocusable(true); ColorDrawable dw = new ColorDrawable(-00000); this.setBackgroundDrawable(dw); this.setOutsideTouchable(false); return this; }
Example #14
Source File: ConnectActivity.java From homeassist with Apache License 2.0 | 6 votes |
private void showError(String message) { Drawable warningIcon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_warning_white_18dp, null); SpannableStringBuilder builder = new SpannableStringBuilder(); builder.append(message); mSnackbar = Snackbar.make(findViewById(android.R.id.content), builder, Snackbar.LENGTH_LONG) .setAction(getString(R.string.action_retry), new OnClickListener() { @Override public void onClick(View view) { attemptLogin(); } }); TextView textView = mSnackbar.getView().findViewById(android.support.design.R.id.snackbar_text); textView.setCompoundDrawablesWithIntrinsicBounds(warningIcon, null, null, null); textView.setCompoundDrawablePadding(getResources().getDimensionPixelOffset(R.dimen.icon_8dp)); mSnackbar.getView().setBackgroundColor(ResourcesCompat.getColor(getResources(), R.color.md_red_A200, null)); mSnackbar.show(); }
Example #15
Source File: X8AiLinePointValueAdapter.java From FimiX8-RE with MIT License | 6 votes |
public void setSigleListener(X8AiPointValueViewHolder holder) { if (this.listener != null) { holder.root.setOnClickListener(new OnClickListener() { public void onClick(View v) { boolean isSelect = true; int pos = ((Integer) v.getTag()).intValue(); if (pos == X8AiLinePointValueAdapter.this.selectIndex) { isSelect = false; } X8AiLinePointValueAdapter.this.listener.onItemClicked(pos, X8AiLinePointValueAdapter.this.selectIndex, isSelect); if (isSelect) { X8AiLinePointValueAdapter.this.selectIndex = pos; } else { X8AiLinePointValueAdapter.this.selectIndex = -1; } } }); } }
Example #16
Source File: PoiAroundSearchActivity.java From TraceByAmap with MIT License | 6 votes |
private void setup() { mPoiDetail = (RelativeLayout) findViewById(R.id.poi_detail); mPoiDetail.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Intent intent = new Intent(PoiSearchActivity.this, // SearchDetailActivity.class); // intent.putExtra("poiitem", mPoi); // startActivity(intent); } }); mPoiName = (TextView) findViewById(R.id.poi_name); mPoiAddress = (TextView) findViewById(R.id.poi_address); mSearchText = (EditText)findViewById(R.id.input_edittext); }
Example #17
Source File: PoiKeywordSearchActivity.java From TraceByAmap with MIT License | 6 votes |
@Override public View getInfoWindow(final Marker marker) { View view = getLayoutInflater().inflate(R.layout.poikeywordsearch_uri, null); TextView title = (TextView) view.findViewById(R.id.title); title.setText(marker.getTitle()); TextView snippet = (TextView) view.findViewById(R.id.snippet); snippet.setText(marker.getSnippet()); ImageButton button = (ImageButton) view .findViewById(R.id.start_amap_app); // 调起高德地图app button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startAMapNavi(marker); } }); return view; }
Example #18
Source File: BottomMenu.java From FoodOrdering with Apache License 2.0 | 6 votes |
public BottomMenu(Activity context,OnClickListener clickListener) { LayoutInflater inflater = LayoutInflater.from(context); this.clickListener=clickListener; mContext=context; mMenuView = inflater.inflate(R.layout.layout_popwindow, null); btn_wxLogin = (Button) mMenuView.findViewById(R.id.btn_wxLogin); btn_msgCheckLogin = (Button) mMenuView.findViewById(R.id.btn_msgCheckLogin); btnCancel = (Button) mMenuView.findViewById(R.id.btn_cancel); btnCancel.setOnClickListener(this); btn_wxLogin.setOnClickListener(this); btn_msgCheckLogin.setOnClickListener(this); popupWindow=new PopupWindow(mMenuView,LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,true); popupWindow.setAnimationStyle(R.style.popwin_anim_style); ColorDrawable dw = new ColorDrawable(context.getResources().getColor(R.color.white)); popupWindow.setBackgroundDrawable(dw); mMenuView.setOnTouchListener(this); }
Example #19
Source File: OnboardingActivity.java From zom-android-matrix with Apache License 2.0 | 6 votes |
public void showUpgradeMessage () { if (TextUtils.isEmpty(Preferences.getValue("showUpgradeMessage"))) { android.support.v7.app.AlertDialog alertDialog = new android.support.v7.app.AlertDialog.Builder(this).create(); alertDialog.setTitle(R.string.welcome_message); alertDialog.setMessage(this.getString(R.string.upgrade_message)); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, this.getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); PreferenceManager.getDefaultSharedPreferences(this).edit().putString("showUpgradeMessage","false").commit(); } }
Example #20
Source File: X8LocalFragmentPresenter.java From FimiX8-RE with MIT License | 6 votes |
private void doPanelTrans(final PanelRecycleViewHolder holder, final int position) { final MediaModel mediaModel = getModel(position); if (mediaModel != null) { holder.tvTitleDescription.setText(getModel(position).getFormatDate().split(" ")[0]); if (mediaModel.isSelect()) { holder.mBtnAllSelect.setImageResource(R.drawable.x8_ablum_select); } else { holder.mBtnAllSelect.setImageResource(R.drawable.x8_ablum_unselect); holder.mBtnAllSelect.setSelected(false); } } holder.mBtnAllSelect.setOnClickListener(new OnClickListener() { public void onClick(View view) { X8LocalFragmentPresenter.this.onItemCategoryClick(holder, position, mediaModel); } }); if (this.isEnterSelectMode) { holder.mBtnAllSelect.setVisibility(0); } else { holder.mBtnAllSelect.setVisibility(8); } }
Example #21
Source File: X8CameraFragmentPrensenter.java From FimiX8-RE with MIT License | 6 votes |
private void doPanelTrans(final PanelRecycleViewHolder holder, final int position) { final MediaModel mediaModel = getModel(position); if (mediaModel != null) { holder.tvTitleDescription.setText(getModel(position).getFormatDate()); if (mediaModel.isSelect()) { holder.mBtnAllSelect.setImageResource(R.drawable.x8_ablum_select); } else { holder.mBtnAllSelect.setImageResource(R.drawable.x8_ablum_unselect); } } holder.mBtnAllSelect.setOnClickListener(new OnClickListener() { public void onClick(View view) { X8CameraFragmentPrensenter.this.onItemCategoryClick(holder, position, mediaModel); } }); if (this.isEnterSelectMode) { holder.mBtnAllSelect.setVisibility(0); } else { holder.mBtnAllSelect.setVisibility(8); } }
Example #22
Source File: Viewhtml.java From styT with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); selectVideo = (TextView) findViewById(R.id.select_video); selectVideo.setOnClickListener(clickListener); tip = (TextView) findViewById(R.id.tip); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); // 初始化Toolbar控件 setSupportActionBar(toolbar); toolbar.setTitle("视频转换Gif"); // 设置标题 // 设置副标题 toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); // 用Toolbar取代ActionBar }
Example #23
Source File: TextClassification.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private TextClassification( @Nullable String text, @Nullable Drawable legacyIcon, @Nullable String legacyLabel, @Nullable Intent legacyIntent, @Nullable OnClickListener legacyOnClickListener, @NonNull List<RemoteAction> actions, @NonNull Map<String, Float> entityConfidence, @Nullable String id) { mText = text; mLegacyIcon = legacyIcon; mLegacyLabel = legacyLabel; mLegacyIntent = legacyIntent; mLegacyOnClickListener = legacyOnClickListener; mActions = Collections.unmodifiableList(actions); mEntityConfidence = new EntityConfidence(entityConfidence); mId = id; }
Example #24
Source File: LoginActivity.java From Build-an-AI-Startup-with-PyTorch with MIT License | 6 votes |
private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new View.OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; }
Example #25
Source File: CallActivity.java From sample-videoRTC with Apache License 2.0 | 6 votes |
private void disconnectWithErrorMessage(final String errorMessage) { if (!activityRunning) { Log.e(TAG, "Critical error: " + errorMessage); disconnect(); } else { new AlertDialog.Builder(this) .setTitle(getText(R.string.channel_error_title)) .setMessage(errorMessage) .setCancelable(false) .setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); disconnect(); } }) .create() .show(); } }
Example #26
Source File: AccessibilityActivity.java From wear-os-samples with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_accessibility); AmbientMode.attachAmbientSupport(this); ImageView accessibilityImage = findViewById(R.id.icon_image_view); accessibilityImage.setImageDrawable(getDrawable(R.drawable.settings_circle)); TextView accessibilityText = findViewById(R.id.icon_text_view); accessibilityText.setText(R.string.accessibility_settings); findViewById(R.id.accessibility_button_include) .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { startActivityForResult( new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), 0); } }); }
Example #27
Source File: LoginActivityB.java From ans-android-sdk with GNU General Public License v3.0 | 6 votes |
private boolean mayRequestContacts() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } if (checkSelfPermission(READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { return true; } if (shouldShowRequestPermissionRationale(READ_CONTACTS)) { Snackbar.make(mEmailView, R.string.permission_rationale, Snackbar.LENGTH_INDEFINITE) .setAction(android.R.string.ok, new OnClickListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onClick(View v) { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } }); } else { requestPermissions(new String[]{READ_CONTACTS}, REQUEST_READ_CONTACTS); } return false; }
Example #28
Source File: MainActivity.java From Flora with MIT License | 5 votes |
private void initToolbar() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); navigationView.setNavigationItemSelectedListener(this); navigationView.getHeaderView(0).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO custom setting } }); }
Example #29
Source File: htmlActivity.java From styT with Apache License 2.0 | 5 votes |
@Override protected void onStart() { // TODO: Implement this method super.onStart(); // 设置标题 // 设置副标题 toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); }
Example #30
Source File: WalletGenActivity.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wallet_gen); password = (EditText) findViewById(R.id.password); passwordConfirm = (EditText) findViewById(R.id.passwordConfirm); walletGenText = (TextView) findViewById(R.id.walletGenText); toolbar_title = (TextView) findViewById(R.id.toolbar_title); coord = (CoordinatorLayout) findViewById(R.id.main_content); Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button); mEmailSignInButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { genCheck(); } }); if (getIntent().hasExtra("PRIVATE_KEY")) { privateKeyProvided = getIntent().getStringExtra("PRIVATE_KEY"); walletGenText.setText(getResources().getText(R.string.import_text)); toolbar_title.setText(R.string.import_title); mEmailSignInButton.setText(R.string.import_button); } // if (((AnalyticsApplication) this.getApplication()).isGooglePlayBuild()) { // ((AnalyticsApplication) this.getApplication()).track("Walletgen Activity"); // } }