当前位置: 首页>>代码示例>>Java>>正文


Java OnClickListener类代码示例

本文整理汇总了Java中android.view.View.OnClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnClickListener类的具体用法?Java OnClickListener怎么用?Java OnClickListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnClickListener类属于android.view.View包,在下文中一共展示了OnClickListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showBrokenAppInstallDialog

import android.view.View.OnClickListener; //导入依赖的package包/类
private void showBrokenAppInstallDialog(final String packageName,
        DialogInterface.OnClickListener onSearchClickListener) {
    new AlertDialog.Builder(this)
        .setTitle(R.string.abandoned_promises_title)
        .setMessage(R.string.abandoned_promise_explanation)
        .setPositiveButton(R.string.abandoned_search, onSearchClickListener)
        .setNeutralButton(R.string.abandoned_clean_this,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    final UserHandleCompat user = UserHandleCompat.myUserHandle();
                    mWorkspace.removeAbandonedPromise(packageName, user);
                }
            })
        .create().show();
    return;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:17,代码来源:Launcher.java

示例2: validateUrl

import android.view.View.OnClickListener; //导入依赖的package包/类
private boolean validateUrl(String url) {
    if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) {
        return true;
    }

    new AlertDialog.Builder(this)
            .setTitle(getText(R.string.invalid_url_title))
            .setMessage(getString(R.string.invalid_url_text, url))
            .setCancelable(false)
            .setNeutralButton(R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    })
            .create()
            .show();
    return false;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:20,代码来源:ConnectActivity.java

示例3: setOnClickPresenter

import android.view.View.OnClickListener; //导入依赖的package包/类
public void setOnClickPresenter(final QuotedMessagePresenter presenter) {
    OnClickListener onClickListener = new OnClickListener() {
        @Override
        public void onClick(View view) {
            switch(view.getId()) {
                case R.id.quoted_text_show:
                    presenter.onClickShowQuotedText();
                    break;
                case R.id.quoted_text_delete:
                    presenter.onClickDeleteQuotedText();
                    break;
                case R.id.quoted_text_edit:
                    presenter.onClickEditQuotedText();
                    break;
            }
        }
    };

    mQuotedTextShow.setOnClickListener(onClickListener);
    mQuotedTextEdit.setOnClickListener(onClickListener);
    mQuotedTextDelete.setOnClickListener(onClickListener);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:QuotedMessageMvpView.java

示例4: bindHeaderView

import android.view.View.OnClickListener; //导入依赖的package包/类
public void bindHeaderView(View view, Recipient recipient) {
    RecipientTokenHolder holder = (RecipientTokenHolder) view.getTag();
    holder.setShowAsHeader(true);

    holder.headerName.setText(recipient.getNameOrUnknown(context));
    if (!TextUtils.isEmpty(recipient.addressLabel)) {
        holder.headerAddressLabel.setText(recipient.addressLabel);
        holder.headerAddressLabel.setVisibility(View.VISIBLE);
    } else {
        holder.headerAddressLabel.setVisibility(View.GONE);
    }

    RecipientAdapter.setContactPhotoOrPlaceholder(context, holder.headerPhoto, recipient);
    holder.headerPhoto.assignContactUri(recipient.getContactLookupUri());

    holder.headerRemove.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            listener.onRecipientRemove(currentRecipient);
        }
    });
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:23,代码来源:AlternateRecipientAdapter.java

示例5: initViews

import android.view.View.OnClickListener; //导入依赖的package包/类
private void initViews() {
    this.mListView = (ListView) this.mPullRefreshListView.getRefreshableView();
    View headerView = View.inflate(getActivity(), R.layout.pf, null);
    this.mListView.addHeaderView(headerView);
    OnClickListener listener = new OnClickListener() {
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.tv_hint:
                    HomeTimelineFragment.this.loadFirst();
                    return;
                case R.id.tv_my_page:
                    MyTimelineActivity.comeOnBaby(HomeTimelineFragment.this.getActivity());
                    return;
                case R.id.tv_find_friends:
                    SearchFriendsActivity.comeOnBaby(HomeTimelineFragment.this.getActivity());
                    return;
                default:
                    return;
            }
        }
    };
    headerView.findViewById(R.id.tv_my_page).setOnClickListener(listener);
    headerView.findViewById(R.id.tv_find_friends).setOnClickListener(listener);
    this.tvHint.setOnClickListener(listener);
    this.mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
            HomeTimelineFragment.this.hideHint();
            HomeTimelineFragment.this.getCurrentStatus();
        }
    });
    this.mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() {
        public void onLastItemVisible() {
            if (!HomeTimelineFragment.this.isLastVisible && HomeTimelineFragment.this
                    .getActivity() != null) {
                HomeTimelineFragment.this.getPreviousStatus();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:40,代码来源:HomeTimelineFragment.java

示例6: onCreateDialog

import android.view.View.OnClickListener; //导入依赖的package包/类
@Override
public Dialog onCreateDialog(int id) {
    if (id == DIALOG_NOTE) {
        if (mProvider != null && mProvider.note != null) {
            return new AlertDialog.Builder(this)
                   .setMessage(mProvider.note)
                   .setPositiveButton(
                       getString(R.string.okay_action),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    finishAutoSetup();
                }
            })
                   .setNegativeButton(
                       getString(R.string.cancel_action),
                       null)
                   .create();
        }
    }
    return null;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:22,代码来源:AccountSetupBasics.java

示例7: initView

import android.view.View.OnClickListener; //导入依赖的package包/类
private void initView() {
    this.tvBind.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            MobclickAgent.onEvent(ScaleIntroActivity.this, Event.bingo_clickBindingScalse);
            ScaleBindActivity.startActivity(ScaleIntroActivity.this);
        }
    });
    this.webView.getSettings().setJavaScriptEnabled(true);
    this.webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
    this.webView.getSettings().setPluginState(PluginState.ON);
    this.webView.getSettings().setUserAgentString(this.webView.getSettings()
            .getUserAgentString() + " App/boohee");
    this.webView.getSettings().setDomStorageEnabled(true);
    this.webView.setWebViewClient(createWebViewClient());
    this.webView.loadUrl(UrlUtils.handleUrl(URL));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:ScaleIntroActivity.java

示例8: showSnackBar

import android.view.View.OnClickListener; //导入依赖的package包/类
private void showSnackBar(int stringRes) {
	int firstVisible =
			layoutManager.findFirstCompletelyVisibleItemPosition();
	int lastVisible = layoutManager.findLastCompletelyVisibleItemPosition();
	int count = adapter.getItemCount();
	boolean scroll = count > (lastVisible - firstVisible + 1);

	Snackbar s = Snackbar.make(list, stringRes, LENGTH_LONG);
	s.getView().setBackgroundResource(R.color.briar_primary);
	if (scroll) {
		OnClickListener onClick = new OnClickListener() {
			@Override
			public void onClick(View v) {
				list.smoothScrollToPosition(0);
			}
		};
		s.setActionTextColor(ContextCompat
				.getColor(getContext(),
						R.color.briar_button_positive));
		s.setAction(R.string.blogs_blog_post_scroll_to, onClick);
	}
	s.show();
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:24,代码来源:FeedFragment.java

示例9: showAnnouncementDialog

import android.view.View.OnClickListener; //导入依赖的package包/类
private void showAnnouncementDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.group_announcement);
    if (group.getOwner().equals(EMClient.getInstance().getCurrentUser()) ||
            group.getAdminList().contains(EMClient.getInstance().getCurrentUser())) {
        final EditText et = new EditText(GroupDetailsActivity.this);
        et.setText(group.getAnnouncement());
        builder.setView(et);
        builder.setNegativeButton(R.string.cancel, null)
                .setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        final String text = et.getText().toString();
                        if (!text.equals(group.getAnnouncement())) {
                            dialog.dismiss();
                            updateAnnouncement(text);
                        }
                    }
                });
    } else {
        builder.setMessage(group.getAnnouncement());
        builder.setPositiveButton(R.string.ok, null);
    }
    builder.show();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:26,代码来源:GroupDetailsActivity.java

示例10: toggleDryRun

import android.view.View.OnClickListener; //导入依赖的package包/类
/**
 * Toggles whether database changes are real or simulated.
 */
private void toggleDryRun() {
    final CharSequence[] items = {getText(R.string.on),
            getText(R.string.off)};
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getText(R.string.dryRunTitle));
    builder.setSingleChoiceItems(items, mDryRun ? 0 : 1,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int item) {
                    dialog.dismiss();
                    mDryRun = item == 0 ? true : false;
                    String msg;
                    if (mDryRun) {
                        msg = "Time changes are simulated.\nDatabase will" +
                                " not be changed.";
                    } else {
                        msg = "Time changes are real.\nDatabase will be " +
                                "changed.";
                    }
                    Utils.infoMsg(DisplaySMSActivity.this, msg);
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}
 
开发者ID:KennethEvans,项目名称:Misc,代码行数:28,代码来源:DisplaySMSActivity.java

示例11: Init

import android.view.View.OnClickListener; //导入依赖的package包/类
public void Init() {
GetSurplusMemory();
Round_img=(ImageView)findViewById(R.id.eliminate_roundimg);
Start_kill=(Button)findViewById(R.id.start_killtask);
release_memory=(TextView)findViewById(R.id.relase_memory);
increase_speed=(TextView)findViewById(R.id.increase_speed);
Allpercent=(TextView)findViewById(R.id.all_percent);
clear_endlayout=(LinearLayout)findViewById(R.id.clear_endlayout);
Clearing_layout=(RelativeLayout)findViewById(R.id.clearing_layout);
Animation animation=AnimationUtils.loadAnimation(EliminateMainActivity.this, R.anim.eliminatedialog_anmiation);
TotalMemory=GetTotalMemory();
Round_img.setAnimation(animation);
Start_kill.setClickable(false);
Start_kill.setOnClickListener(new OnClickListener() {
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub
	finish();	
	}
});
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:23,代码来源:EliminateMainActivity.java

示例12: showOneButtonDiolag

import android.view.View.OnClickListener; //导入依赖的package包/类
public static void showOneButtonDiolag(Context mContext, CharSequence titleString, CharSequence msgString,
		CharSequence btnString, boolean cancelable, final OnClickListener positiveListener) {
	final EasyAlertDialog dialog = new EasyAlertDialog(mContext);
	if (TextUtils.isEmpty(titleString)) {
		dialog.setTitleVisible(false);
	} else {
		dialog.setTitle(titleString);
	}
	if (TextUtils.isEmpty(msgString)) {
		dialog.setMessageVisible(false);
	} else {
		dialog.setMessage(msgString);
	}
	dialog.setCancelable(cancelable);
	dialog.addPositiveButton(TextUtils.isEmpty(btnString) ? mContext.getString(R.string.iknow) : btnString,
			EasyAlertDialog.NO_TEXT_COLOR, EasyAlertDialog.NO_TEXT_SIZE, new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					dialog.dismiss();
					if (positiveListener != null)
						positiveListener.onClick(v);
				}
			});
	dialog.show();
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:26,代码来源:EasyAlertDialogHelper.java

示例13: ChannelDetailItemActivity

import android.view.View.OnClickListener; //导入依赖的package包/类
public ChannelDetailItemActivity() {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    this.onClickEvent = new OnClickListener(this) {
        final /* synthetic */ ChannelDetailItemActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.back_btn /*2131361912*/:
                    this.this$0.finish();
                    return;
                default:
                    return;
            }
        }
    };
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:26,代码来源:ChannelDetailItemActivity.java

示例14: onStart

import android.view.View.OnClickListener; //导入依赖的package包/类
@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();
				}
			});
//		设置导航按钮监听
    }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:21,代码来源:Viewhtml.java

示例15: getView

import android.view.View.OnClickListener; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
	ViewHolder viewHolder=null;
	if(convertView==null){
		viewHolder=new ViewHolder();
		convertView=mInflater.inflate(R.layout.item_search_list,null);
		viewHolder.tvCityName=(TextView) convertView.findViewById(R.id.tv_city_name);
		convertView.setTag(viewHolder);
	}else{
		viewHolder =(ViewHolder) convertView.getTag();
	}
	
	viewHolder.tvCityName.setText(mSearchList.get(position).getName());
	viewHolder.tvCityName.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			Toast.makeText(mContext,mSearchList.get(position).getName(),0).show();
		}
	});
	
	return convertView;
}
 
开发者ID:jacksenh,项目名称:CitySelct,代码行数:24,代码来源:SearchResultAdapter.java


注:本文中的android.view.View.OnClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。