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(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); unbinder = ButterKnife.bind(this); SharedPreferences sharedPreferences = PreferenceManager.getSharedPref(this); String currentEnv = sharedPreferences.getString(Constants.PREF_ENV, ""); if(ENV[0].equals(currentEnv)) { mCurrentEnvIndex = 0; } else { mCurrentEnvIndex = 1; } mLoginAKBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryLogin(); } }); }
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; }
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; }
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); }
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); } }); }
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(); } } }); }
@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; }
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)); }
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(); }
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(); }
/** * 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(); }
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(); }
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; } } }; }
@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(); } }); // 设置导航按钮监听 }
@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; }
private void receiveMessages(int i) { if (checkState == CheckState.EXIST) { changeState(State.RECEIVEING); slotIndex = i; String address = mainActivity.getSavedValue("REMO_DEVICE_ADDRESS"); remoController.recevieMessages(address); receiveDialog = new ProgressDialog(mainActivity); receiveDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { receiveDialog.cancel(); } }); receiveDialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { Log.d(TAG, "onCancel: "); changeState(State.IDLE); remoController.cancelReceiveMessages(); } }); receiveDialog.setMessage(getString(R.string.remo_receive_dialog)); receiveDialog.show(); } }
public PushRegistrationReminder(final Context context, final MasterSecret masterSecret) { super(context.getString(R.string.reminder_header_push_title), context.getString(R.string.reminder_header_push_text)); final OnClickListener okListener = new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, RegistrationActivity.class); intent.putExtra("master_secret", masterSecret); intent.putExtra("cancel_button", true); context.startActivity(intent); } }; setOkListener(okListener); }
private void initView() { this.mCapacityRoot = findViewById(2131361935); this.mCapacityTextView = (TextView) findViewById(2131361937); this.mCapacityPBar = (ProgressBar) findViewById(2131361936); this.mTipLayout = findViewById(R.id.download_vip_layout); this.mVipTipTV = (TextView) findViewById(R.id.download_vip_tip); this.mOpenVipTV = (TextView) findViewById(R.id.download_open_vip_btn); this.mOpenVipTV.setOnClickListener(new OnClickListener(this) { final /* synthetic */ MyDownloadActivity this$0; { if (HotFix.PREVENT_VERIFY) { System.out.println(VerifyLoad.class); } this.this$0 = this$0; } public void onClick(View v) { LetvVipActivity.launch(this.this$0.mContext, this.this$0.mContext.getResources().getString(2131100645)); StatisticsUtils.statisticsActionInfo(this.this$0.mContext, PageIdConstant.downloadingPage, "0", "vp13", "开通会员", 1, PreferencesManager.getInstance().isVip() ? "vip=1" : "vip=0"); } }); initNavigationBar(); initViewPager(); }
/** * method that shows a dialog asking what string the user wishes to search * for. It highlights the text entered. */ private void findInPage() { final AlertDialog.Builder finder = new AlertDialog.Builder(mActivity); finder.setTitle(getResources().getString(R.string.action_find)); final EditText getHome = new EditText(this); getHome.setHint(getResources().getString(R.string.search_hint)); finder.setView(getHome); finder.setPositiveButton(getResources().getString(R.string.search_hint), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String query = getHome.getText().toString(); if (query.length() > 0) showSearchInterfaceBar(query); } }); finder.show(); }
private void initDietView() { this.dietPopView.init(this.record_on); this.dietPopView.setOnDateClickListener(new OnDateClickListener() { public void onDateClick(Date date) { if (date != null) { DietSportCalendarActivity.this.refreshDietAndSport(date); } } public void onBottomClick() { } }); this.dietPopView.bt_today.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (DietSportCalendarActivity.this.dietPopView.isShowing()) { DietSportCalendarActivity.this.dietPopView.dismiss(); } DietSportCalendarActivity.this.dietPopView.postDelayed(new Runnable() { public void run() { DietSportCalendarActivity.this.refreshDietAndSport(new Date()); } }, 500); } }); }
public View getView(int position, View convertView, ViewGroup parent) { final Device deviceInfo = (Device) getItem(position); ViewHolder holder = ViewHolder.get(this.mContext, convertView, R.layout.devices_list_item); TextView devName = (TextView) holder.getView(R.id.device_title); int padding = UIsUtils.dipToPx(TitleBar.SHAREBTN_RIGHT_MARGIN); devName.setPadding(0, padding, 0, padding); devName.setText(BaseTypeUtils.ensureStringValidate(deviceInfo.getFriendlyName())); ImageView iv = (ImageView) holder.getView(R.id.device_already_playing); iv.setVisibility(4); Device playingDevice = DLNADevicesDialogHelper.this.mController.mPlayingDevice; if (playingDevice != null && playingDevice.getFriendlyName().equals(deviceInfo.getFriendlyName())) { iv.setVisibility(0); } holder.getConvertView().setOnClickListener(new OnClickListener() { public void onClick(View v) { DLNADevicesDialogHelper.this.mController.play(deviceInfo); DLNADevicesDialogHelper.this.dismissDialog(); } }); return holder.getConvertView(); }
@Override protected Dialog onCreateDialog(int id) { OnClickListener onclick = new OnClickListener() { public void onClick(View view) { dismissDialog(0); final int viewId = view.getId(); if (R.id.button1 == viewId) { CommonPrefs.openQuickerInMarket(MainSettingsActivity.this); } } }; Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.quicker_ads); dialog.findViewById(R.id.button1).setOnClickListener(onclick); dialog.findViewById(R.id.button2).setOnClickListener(onclick); return dialog; }
private void ensureCollapseButtonView() { if (this.mCollapseButtonView == null) { this.mCollapseButtonView = new ImageButton(getContext(), null, R.attr.toolbarNavigationButtonStyle); this.mCollapseButtonView.setImageDrawable(this.mCollapseIcon); this.mCollapseButtonView.setContentDescription(this.mCollapseDescription); LayoutParams lp = generateDefaultLayoutParams(); lp.gravity = GravityCompat.START | (this.mButtonGravity & 112); lp.mViewType = 2; this.mCollapseButtonView.setLayoutParams(lp); this.mCollapseButtonView.setOnClickListener(new OnClickListener() { public void onClick(View v) { Toolbar.this.collapseActionView(); } }); } }
/** * @brief Shows the dialog when any field is empty * @return The new dialog * @details Shows the dialog when any field is empty */ private Dialog createAlertDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); String info = getString(R.string.DialogInfo); String someEmpty = getString(R.string.DialogSomethingEmpty); builder.setTitle(info); builder.setMessage(someEmpty); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); return builder.create(); }
public static void showDeleteDialog(final Activity activity, final Post post, final PostMenuListener postMenuListener) { new Builder(activity).setMessage("确定要删除吗?").setPositiveButton("删除", new DialogInterface .OnClickListener() { public void onClick(DialogInterface dialog, int id) { StatusApi.deletePost(activity, post.id, new JsonCallback(activity) { public void ok(JSONObject object) { super.ok(object); if (postMenuListener != null) { postMenuListener.onPostDelete(); } } }); } }).setNegativeButton("取消", null).show(); }
private void setCreateIssueButton(View v) { mFabCreateIssue = (FloatingActionButton) v.findViewById(R.id.fab_add); mCreateIssueListener = new View.OnClickListener() { @Override public void onClick(final View view) { if (CivifyMap.getInstance().isMapReady()) { mIssueAdapter.canCreateIssue(new SimpleCallback() { @Override public void onSuccess() { CivifyMap.getInstance().setCanBeDisabled(false); Intent intent = new Intent(getActivity().getApplicationContext(), CreateIssueActivity.class); startActivityForResult(intent, CreateIssueActivity.ISSUE_CREATION); } @Override public void onFailure(String errorMessage) { Snackbar.make(view, R.string.issue_once_hour, Snackbar.LENGTH_LONG).show(); } }); } else showMapLoadingWarning(view); } }; mFabCreateIssue.setOnClickListener(mCreateIssueListener); }
@Override protected void init(OnClickListener... args) { mBtnSinaWeibo.setOnClickListener(mOnClickListener); mBtnQzone.setOnClickListener(mOnClickListener); mBtnWechatMoments.setOnClickListener(mOnClickListener); mBtnWechat.setOnClickListener(mOnClickListener); mBtnQQ.setOnClickListener(mOnClickListener); mBtnLocal.setOnClickListener(mOnClickListener); mOnCompleteClick = args[0]; mBtnComplete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startAnimOut(); } }); }
/** * Get a header view. This optionally pulls a header from the supplied * {@link WrapperView} and will also recycle the divider if it exists. */ private View configureHeader(WrapperView wv, final int position) { View header = wv.mHeader == null ? popHeader() : wv.mHeader; header = mDelegate.getHeaderView(position, header, wv); if (header == null) { throw new NullPointerException("Header view must not be null."); } //if the header isn't clickable, the listselector will be drawn on top of the header header.setClickable(true); header.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(mOnHeaderClickListener != null){ long headerId = mDelegate.getHeaderId(position); mOnHeaderClickListener.onHeaderClick(v, position, headerId); } } }); return header; }
private void showComparationResultsDialog(DecimalFormat decimalFormat){ AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this); alert.setTitle(getString(R.string.comparation_results_dialog_title)); alert.setMessage("IMU:" + "\n X = " + decimalFormat.format(xSensorAxis) + "\n Y = " + decimalFormat.format(ySensorAxis) + "\nCamera:" + "\n X = " + decimalFormat.format(checkerboardPatternComputingInitializer.getxAxis()) + "\n Y = " + decimalFormat.format(checkerboardPatternComputingInitializer.getyAxis())); alert.setPositiveButton(getString(R.string.comparation_results_dialog_positive_button_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog comparationResultsDialog = alert.create(); comparationResultsDialog.show(); }
private void findView() { this.realNameValue = (EditText) findViewById(R.id.real_name_value); this.phoneNumValue = (EditText) findViewById(R.id.phone_num_value); this.postCodeValue = (EditText) findViewById(R.id.post_code_value); this.addressDetailsValue = (EditText) findViewById(R.id.address_details_value); this.txt_address_regions = (TextView) findViewById(R.id.txt_address_regions); this.txt_address_regions.setOnClickListener(new OnClickListener() { public void onClick(View v) { Keyboard.closeAll(AddressEditActivity.this.ctx); RegionsPopwindow popwindow = RegionsPopwindow.getInstance(); popwindow.setRegionChangeListener(new onRegionChangeListener() { public void onChange(String provice, String city, String district) { AddressEditActivity.this.address_province = provice; AddressEditActivity.this.address_city = city; AddressEditActivity.this.address_district = district; AddressEditActivity.this.txt_address_regions.setText(provice + " " + city + " " + district); } }); popwindow.showRegionsPopWindow(AddressEditActivity.this.ctx, AddressEditActivity .this.address_province, AddressEditActivity.this.address_city, AddressEditActivity.this.address_district); } }); }
private void showAnnouncementDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.group_announcement); if (room.getOwner().equals(EMClient.getInstance().getCurrentUser()) || room.getAdminList().contains(EMClient.getInstance().getCurrentUser())) { final EditText et = new EditText(ChatRoomDetailsActivity.this); et.setText(room.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(room.getAnnouncement())) { dialog.dismiss(); updateAnnouncement(text); } } }); } else { builder.setMessage(room.getAnnouncement()); builder.setPositiveButton(R.string.ok, null); } builder.show(); }
private View getSelectItemView(final com.boohee.model.Event event) { if (event == null) { return null; } View itemView = LayoutInflater.from(getActivity()).inflate(R.layout.k7, null); TextView select_name_tv = (TextView) itemView.findViewById(R.id.main_group_item_name_tv); TextView select_title = (TextView) itemView.findViewById(R.id.main_group_item_title_tv); this.imageLoader.displayImage(event.pic_url, (ImageView) itemView.findViewById(R.id .main_group_iv), ImageLoaderOptions.global((int) R.drawable.aa4)); select_name_tv.setText(event.title); select_title.setText(event.desc); itemView.setOnClickListener(new OnClickListener() { public void onClick(View v) { MobclickAgent.onEvent(NewPartnerFragment.this.getActivity(), Event .status_clickCategoryItem); if (!TextUtils.isEmpty(event.url)) { BooheeScheme.handleUrl(NewPartnerFragment.this.getActivity(), event.url); } } }); return itemView; }
@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(); } }); }
public void onClick(View v) { int id = v.getId(); if (R.id.btn_share == id) { this.mIvQrCodeArea.setDrawingCacheEnabled(true); PageJumpUtil.jumpToPageSystemShare(this, "", "", "", Uri.parse(Media.insertImage(getContentResolver(), this.mIvQrCodeArea.getDrawingCache(), null, null))); } else if (R.id.btn_refresh == id) { DialogUtil.showDialog(this, getResources().getString(R.string.qrcode_gen_refresh_prompt), "", "", null, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); QrCodeShareActivity.this.refreshQrCode(); } }); } else if (R.id.common_nav_left == id) { finish(); } }
private void handleSaveAttachment(final MediaMmsMessageRecord message) { SaveAttachmentTask.showWarningDialog(getActivity(), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { for (Slide slide : message.getSlideDeck().getSlides()) { if ((slide.hasImage() || slide.hasVideo() || slide.hasAudio() || slide.hasDocument()) && slide.getUri() != null) { SaveAttachmentTask saveTask = new SaveAttachmentTask(getActivity(), masterSecret, list); saveTask.execute(new Attachment(slide.getUri(), slide.getContentType(), message.getDateReceived(), slide.getFileName().orNull())); return; } } Log.w(TAG, "No slide with attachable media found, failing nicely."); Toast.makeText(getActivity(), getResources().getQuantityString(R.plurals.ConversationFragment_error_while_saving_attachments_to_sd_card, 1), Toast.LENGTH_LONG).show(); } }); }
private void uploadHeadPhoto() { Builder builder = new Builder(this); builder.setTitle(R.string.dl_title_upload_photo); builder.setItems(new String[] { getString(R.string.dl_msg_take_photo), getString(R.string.dl_msg_local_upload) }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); switch (which) { case 0: Toast.makeText(UserProfileActivity.this, getString(R.string.toast_no_support), Toast.LENGTH_SHORT).show(); break; case 1: Intent pickIntent = new Intent(Intent.ACTION_PICK,null); pickIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(pickIntent, REQUESTCODE_PICK); break; default: break; } } }); builder.create().show(); }
@Override protected void onStart() { // TODO: Implement this method super.onStart(); toolbar.setTitle("发布动态"); // 设置标题 // 设置副标题 toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); // 设置导航图标 toolbar.setNavigationOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { finish(); } }); }
/** * Creates and returns a listener, which allows to toggle the visibility of the tab switcher, * when a button is clicked. * * @return The listener, which has been created, as an instance of the type {@link * OnClickListener}. The listener may not be null */ @NonNull private OnClickListener createTabSwitcherButtonListener() { return new OnClickListener() { @Override public void onClick(final View view) { tabSwitcher.toggleSwitcherVisibility(); } }; }