在这里,我们将给大家分享关于人肉分析sorted(lst,key=lambdax:(x.isdigit(),x.isdigit()andint(x)%2==0,x.islower(),x.isupp.
在这里,我们将给大家分享关于人肉分析sorted(lst, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x.isupp...的知识,同时也会涉及到如何更有效地.gitignore for Visual Studio项目和解决方案 - .gitignore for Visual Studio Projects and Solutions、android.content.DialogInterface.OnDismissListener的实例源码、android.text.method.DigitsKeyListener的实例源码、C#中 Char.IsDigit() 和 Char.IsNumber() 的区别的内容。
本文目录一览:- 人肉分析sorted(lst, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x.isupp...
- .gitignore for Visual Studio项目和解决方案 - .gitignore for Visual Studio Projects and Solutions
- android.content.DialogInterface.OnDismissListener的实例源码
- android.text.method.DigitsKeyListener的实例源码
- C#中 Char.IsDigit() 和 Char.IsNumber() 的区别
人肉分析sorted(lst, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x.isupp...
闲来无事惹麻烦
闲的慌于是打算看下python基础的一些函数,看到sorted的时候发现了比较怪异的排序需求,于是就有了这篇博文
1. 需求
大写字母在前,小写字母在后
所有的字母在数字前面
所有的奇数在偶数前面
2. 必须知道的sorted知识点
sorted函数如果返回的是一个元组, 那么排序规则是: 先对比所有元组的第一个元素, 再对比第二个...第n个
reverse参数为false, 为升序排列, 例如:
lst = [(0, 3), (0, 2), (1, 1)]
print(sorted(lst)) # reverse=Flase
第一次:[(0, 3),(0, 2),(1, 1)] # 和原来保持一致, 因为各个元组的第一个元素已经是升序了
第二次:[(0, 2),(0,3),(1,1)] # 原来列表的第一个元素和第二个元素位置互换, 因为(0,2)的第二个元素小于(0,3)的第二个元素,所以在前面
3. 被排序字符串str_sorted = ''H73Wo''
其实呢sorted(list1, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x)) 和
sorted(lst, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x.isupper(), x))过程效果是一毛一样的
先说一下这个表达式是怎么得出的:
1. 首先我们被排序的字符串中的元素分为两类: 1. 字母 2. 数字
2. 既然字母需要在前, 所以我们lambda函数结果中元组第一个元素一定要把字母和数字分开(# 这里直接用x.digist(), 如果为数字那么就一定在字母后面, 也就达到了我们的第二个目的)
3. 大写字母要在小写字母前, 那么就是大写需要为False即x.lower()为假即可
4. 最后是奇数在偶数前: 即x.digist() and int(x) % 2 == 0 为真即可
5. 最最后如果还要求按照升序排列 则最后加一个x 即可
<body> <div> <table> <thead> <th>编号</th> <th>元素</th> <th>被sorted函数作用后的元素结果</th> </thead> <tbody> <tr> <td>1</td> <td>Z</td> <td>(False, False, False, Z)</td> </tr> <tr> <td>2</td> <td>7</td> <td>(True, False, False, 7)</td> </tr> <tr> <td>3</td> <td>2</td> <td>(True, True, False, 2)</td> </tr> <tr> <td>4</td> <td>W</td> <td>(False, False, False, W)</td> </tr> <tr> <td>5</td> <td>o</td> <td>(False, False, True, o)</td> </tr> <tr> <td>6</td> <td>3</td> <td>(True, False, False, 3)</td> </tr> </tbody> </table> </div> </body> 上面说了两种表达式的结果是一毛一样(可以自测一下)的,所以我就选择结果表达式字符少的来举例吧(偷懒了哈哈) #### 过程分析 ``` "|" 符号左边是字母,右边是数字, 这里具体的就用需要代替了,最后出结果的时候再换上对应的字符
第一次排序. 145 236 即 ZWo 723 第二次排序. 145 263 即 ZWo 732 第三次排序. 145 263 即 ZWo 732 第四次排序. 415 623 即 WZo 372 所以结果就出来啦[''W'', ''Z'', ''o'', ''3'', ''7'', ''2'']
.gitignore for Visual Studio项目和解决方案 - .gitignore for Visual Studio Projects and Solutions
问题:
将Git与Visual Studio Solutions( .sln
)和Projects结合使用时,我应该在.gitignore
包含哪些文件?
解决方案:
参考一: https://stackoom.com/question/8zjw/gitignore-for-Visual-Studio项目和解决方案参考二: https://oldbug.net/q/8zjw/gitignore-for-Visual-Studio-Projects-and-Solutions
android.content.DialogInterface.OnDismissListener的实例源码
protected void showErrorDialog(int errorMessageId) { stopLoop = true; final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.test_dialog_error_title); builder.setMessage(errorMessageId); builder.setNeutralButton(android.R.string.ok,null); dismissDialogs(); errorDialog = builder.create(); errorDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { final RMBTMainActivity activity = (RMBTMainActivity) getActivity(); if (activity != null) activity.getSupportFragmentManager().popBackStack(); } }); errorDialog.show(); }
@Override protected void onPreExecute() { // mProgressDialog = new ProgressDialog(context,ProgressDialog.THEME_DEVICE_DEFAULT_LIGHT); mProgressDialog.setTitle(""); mProgressDialog.setMessage(activity .getString(R.string.mixradio_dialog)); mProgressDialog.setProgressstyle(ProgressDialog.STYLE_SPINNER); mProgressDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { // mTask.cancel(true); } }); mProgressDialog.show(); super.onPreExecute(); }
/** * Show the attributes dialog for the specified {@code viewItem} if applicable * * @param viewItem * the item chosen to show the attributes */ private void showDialogAttributes(final ViewItem viewItem) { ArrayList<modelattribute> attributesValid = (ArrayList<modelattribute>) getAttributes(viewItem); // Show the dialog finally if they have any choice. if (!attributesValid.isEmpty()) { DlgAttributes dlg = new DlgAttributes(this,attributesValid); dlg.setondismissListener(new OndismissListener() { public void ondismiss(DialogInterface dialog) { // Fetch the attribute they chose,if any. modelattribute modelattribute = ((DlgAttributes) dialog).getSelectedAttribute(); if (modelattribute != null) { viewItem.insertAttribute(modelattribute); } } }); dlg.show(); } else { // Shouldn't happen but leaving in for safety UtilUI.showAlert(this,"Sorry!","There are no matching parameters for the selected attribute type!"); } }
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_ID_INFO: AlertDialog dlginfo = new AlertDialog.Builder(this) .setTitle(mStateHolder.getDlginfoTitle()) .setIcon(0) .setMessage(mStateHolder.getDlginfoMessage()).create(); dlginfo.setondismissListener(new OndismissListener() { public void ondismiss(DialogInterface dialog) { removeDialog(DIALOG_ID_INFO); } }); try { Uri icon = Uri.parse(mStateHolder.getDlginfoBadgeIconUrl()); dlginfo.setIcon(new BitmapDrawable(((Foursquared) getApplication()) .getRemoteResourceManager().getInputStream(icon))); } catch (Exception e) { Log.e(TAG,"Error loading badge dialog!",e); dlginfo.setIcon(R.drawable.default_on); } return dlginfo; } return null; }
/**弹出窗口消失会发送该事件**/ public synchronized static void setondismissListener(OndismissListener l) { if(mOndismissListener == l) return; final OndismissListener oldListnener = mOndismissListener; mOndismissListener = l; if(oldListnener != null) { final MyDialog dialog = MyDialog.get(); if(dialog != null) { if(mUiThread != Thread.currentThread()) { if(mHandler != null) mHandler.post(new Runnable() { @Override public void run() { oldListnener.ondismiss(dialog); } }); }else { oldListnener.ondismiss(dialog); } } } }
private void createListeningDialog() { _listeningDialog = new ListeningDialog(this); _listeningDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { if (_currentRecognizer != null) // Cancel the current recognizer { _currentRecognizer.cancel(); _currentRecognizer = null; } if (!_destroyed) { VoiceActivity.this.removeDialog(LISTENING_DIALOG); createListeningDialog(); } } }); }
@Override public boolean touchdown(int pid,float x,float y) { if (dRect.contains(x,y)) { final Selector selector = new Selector(parent.getContext(),getValues()); selector.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { Integer v = selector.getSelectedValue(); if (v != null){ val = v; doSend(); parent.threadSafeInvalidate(); } dialog.dismiss(); } }); selector.show(); return true; } return false; }
private void openEditDialog() { final NumberBoxDialog editDialog = new NumberBoxDialog(parent.getContext(),val); editDialog.setTitle(label == null ? "Edit number" : label); editDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { Float selectedValue = editDialog.getSelectedValue(); if(selectedValue != null) { setval(selectedValue.floatValue()); sendFloat(val); parent.invalidate(); } } }); editDialog.show(); }
private void openEditDialog() { final SymbolDialog editDialog = new SymbolDialog(parent.getContext(),value); editDialog.setTitle(label == null ? "Edit symbol" : label); editDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { String selectedValue = editDialog.getSelectedValue(); if(selectedValue != null) { setValue(selectedValue); parent.invalidate(); } } }); editDialog.show(); }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
/** * Show a list of the templates in the database,selection will either load a template or start the edit dialog on * it * * @param context Android context * @param manage if true the template editor will be started otherwise the template will replace the current OH * value */ void loadOrManageTemplate(Context context,boolean manage) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(context); View templateView = (View) inflater.inflate(R.layout.template_list,null); alertDialog.setTitle(manage ? R.string.manage_templates_title : R.string.load_templates_title); alertDialog.setView(templateView); ListView lv = (ListView) templateView.findViewById(R.id.listView1); final sqliteDatabase writableDb = new TemplateDatabaseHelper(context).getWritableDatabase(); templateCursor = TemplateDatabase.queryByKey(writableDb,manage ? null : key); templateAdapter = new TemplateAdapter(writableDb,context,templateCursor,manage); lv.setAdapter(templateAdapter); alertDialog.setNegativeButton(R.string.Done,null); alertDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { templateCursor.close(); writableDb.close(); } }); templateDialog = alertDialog.show(); }
private void showDialog() { final MaterialDialog materialDialog = new MaterialDialog(mContext); materialDialog.setCanceledOnTouchOutside(true); materialDialog.setMessage("这里是用来展示的文字信息的东西").setTitle("标题").setPositiveButton("确定",new OnClickListener() { @Override public void onClick(View v) { materialDialog.dismiss(); } }).setNegativeButton("取消",null); materialDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { Toast.makeText(mContext,"运行到关闭了",Toast.LENGTH_SHORT).show(); } }); materialDialog.show(); }
public static final void showProgressDialog(Context context,String title,String message,OndismissListener ondismissListener) { if (context == null) { return; } dismissDialog(); if (TextUtils.isEmpty(title)) { title = ""; } if (TextUtils.isEmpty(message)) { message = context.getString(R.string.loading); } mProgressDialog = ProgressDialog.show(context,title,message); mProgressDialog.setCancelable(true); mProgressDialog.setCanceledOnTouchOutside(false); mProgressDialog.setondismissListener(ondismissListener); }
private void browse() { if (mbrowser == null) { mbrowser = Filebrowser.createFilebrowser(this,"/",".m3u",new OnFileSelectedListener() { @Override public void onFileSelected(String path) { prepareData(path); if (mbrowser != null && mbrowser.isShowing()) { mbrowser.dismiss(); } } }); mbrowser.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { mbrowse.requestFocus(); } }); } mbrowser.show(); }
public void pmTopicSeeAllPrevIoUsMessagesClick(View view) { seeAllMessagesDialog = new ProgressDialog(this); seeAllMessagesDialog.setCancelable(true); seeAllMessagesDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { stopLoadingallMessages = true; } }); seeAllMessagesDialog.setTitle(R.string.genericLoading); seeAllMessagesDialog.setIndeterminate(true); seeAllMessagesDialog.setMessage(String.format(getString(R.string.pmTopicLoadedMessages),0)); seeAllMessagesDialog.show(); allMessagesCounter = 25; currentPage++; loadPrevIoUsMessages(true); }
/** * displays a dialog to select question sets for voting. Loads selected * question set and sets UI to display values. */ private void loadQuestion() { if (!_isVotingRunning) { String title = getString(R.string.load_question_set); final FileImportDialog dialog = new FileImportDialog(this,new NameXMLFileFilter(),title); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog2) { setCurrentFile(dialog.getSelectedFile()); if (_currentFile != null) { readFile(_currentFile); } } }); dialog.show(); } }
/** * Opens a dialog to choose the voting results from. Triggers file * processing,if a valid file has been selected. */ private void openResults() { String title = getString(R.string.title_load_Votes); final FileImportDialog dialog = new FileImportDialog(this,new LectureFileFilter(),title); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog2) { File f = dialog.getSelectedFile(); if (f != null) { readFile(f); } } }); dialog.show(); }
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id) { final int selectedPosition = position; final TextInputDialog input = new TextInputDialog(getActivity(),getString(R.string.enter_answer)); input.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { String updatedText = input.getText(); if (!updatedText.equals("")) { _questionModel.getAnswers().set(selectedPosition,updatedText); _answerAdapter.notifyDataSetChanged(); } } }); input.setInputText(_questionModel.getAnswers().get(selectedPosition)); input.show(); }
@Override public void onItemClick(AdapterView<?> parent,updatedText); _answerAdapter.notifyDataSetChanged(); } } }); input.setInputText(_questionModel.getAnswers().get(selectedPosition)); input.show(); }
/** * Method to import qti questions and add them to the current questionset. */ private void importQTI() { String title = getString(R.string.qti_import); final FileImportDialog dialog = new FileImportDialog(this,new ZipFileFilter(),title); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog2) { setQtiFile(dialog.getSelectedFile()); if (_qtiFile != null) { QTIImportService qtiService = new QTIImportService(); QuestionSet questions = qtiService.getQuestions(_qtiFile); for (QuestionModel questionModel : questions) { _currentQuestionset.addQuestionModel(questionModel); } _questionAdapter.notifyDataSetChanged(); // Check if qti import was 100% successful checkQTIAfterImport(qtiService,questions); } } }); dialog.show(); }
/** * Opens a dialog to select prevIoUsly saved questions. Loads them after * selection. */ private void loadQuestion() { String title = getString(R.string.load_question_set); final FileImportDialog dialog = new FileImportDialog(this,title); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog2) { File f = dialog.getSelectedFile(); if (f != null) { setCurrentFile(f); readFile(_currentFile); } } }); dialog.show(); }
private static void showErrorDialog(Exception e,android.content.Context androidContext){ // show a dialog AlertDialog alertDialog = new AlertDialog.Builder( androidContext).create(); alertDialog.setTitle("Error starting application"); alertDialog.setMessage("Failed to start the Osgi runtime \n" +e.getMessage()); alertDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { System.exit(-1); } }); alertDialog.show(); }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
@Override public void onAttach(final Activity activity) { super.onAttach(activity); if (activity instanceof OnClickListener) { mClickListener = (OnClickListener) activity; } else { throw new IllegalStateException("Activity must implement DialogInterface.OnClickListener"); } if (activity instanceof OndismissListener) { mOndismissListener = (OndismissListener) activity; } }
/** * Show a dialog with the acceleration event settings. */ private void showSettingsDialog() { SettingsDialog dialog = new SettingsDialog(this); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface arg0) { // Read the new preferences. readPrefs(); } }); dialog.show(); }
@Override protected Dialog onCreateDialog(int id) { switch (id) { case cpu_WARNING_DIALOG: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.app_name).setMessage(R.string.cpu_warning); AlertDialog alert = builder.create(); alert.setondismissListener(new OndismissListener() { public void ondismiss(DialogInterface dialog) { finish(); } }); return alert; } return null; }
/** * Creates a dialog for given message. * * @param activity Parent activity. * @param message Message contents * @param dismissListener Listener that will be called when dialog is closed or * cancelled. * @return Created dialog. */ public static Dialog createMessageDialog(Activity activity,Message message,OndismissListener dismissListener) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final String title = message.description == null ? null : message.description.get(MessageDescription.KEY_TITLE); if (!Utilities.isNullOrEmpty(title)) { builder.setTitle(title); } final View dialogContentsView = createMessageDialogContentsView(activity,message.description); builder.setView(dialogContentsView); initializeMessageDialogButtons(activity,builder,message); builder.setCancelable(true); final AlertDialog dialog = builder.create(); if (Utilities.isNullOrEmpty(title)) { dialog.getwindow().requestFeature(Window.FEATURE_NO_TITLE); } dialog.setondismissListener(dismissListener); return dialog; }
private Dialog createDialogInstructions(String title,String msg,String buttonText,OndismissListener ondismiss) { // Use the custom instruction layout for the dialog. LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layoutInstructions = (LinearLayout) inflater.inflate(R.layout.linearlayout_instructions,null,false); TextView textViewMessage = (TextView) layoutInstructions.findViewById(R.id.TextViewDialogInstructions); Button buttonOK = (Button) layoutInstructions.findViewById(R.id.ButtonDialogInstructionsOK); Dialog dialog = new Dialog(mActivity); dialog.getwindow().setBackgroundDrawableResource(R.color.background_dialog); dialog.setContentView(layoutInstructions); dialog.setTitle(title); dialog.setondismissListener(ondismiss); textViewMessage.setText(msg); buttonOK.setText(buttonText); buttonOK.setonClickListener(mOnClickButtonDialogInstructionsOK); mDialogInstructions = dialog; return mDialogInstructions; }
@Click(R.id.addAccount) public void addAccount() { dialog = new AccountDialog(this,null); dialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(final DialogInterface paramDialogInterface) { final Account account = dialog.getAccount(); if (account != null) { accounts.add(account); } updateAccounts(); } }); dialog.show(); }
/** * 设置关闭dialog 监听 * * @param listener * @return */ public UIActionSheetView setondismissListener(OndismissListener listener) { dialog.setondismissListener(listener); if (lLayoutItem != null) { lLayoutItem.removeAllViews(); } if (lLayoutItem != null) lLayoutItem.removeAllViews(); return this; }
private void updatePresentation() { MediaRouter.RouteInfo route = mediaRouter .getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO); display presentationdisplay = route != null ? route .getPresentationdisplay() : null; if (displayPresentation != null && displayPresentation.getdisplay() != presentationdisplay) { displayPresentation.dismiss(); displayPresentation = null; } if (displayPresentation == null && presentationdisplay != null) { displayPresentation = new displayPresentation(this,presentationdisplay); displayPresentation.setondismissListener( new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { if (dialog == displayPresentation) { displayPresentation = null; } } } ); displayPresentation.show(); displayPresentation.go(displayLayout.getCurrentSlidePos(),displayLayout.getCurrentSlidePhase()); } }
/** * @param autoplay 是否自动播放提示 * @return */ @TargetApi(Build.VERSION_CODES.KITKAT) public GuideHelper show(boolean autoplay) { this.autoplay = autoplay; //关闭dialog,移除handler消息 dismiss(); handler.removeCallbacksAndMessages(null); //创建dialog layout = new InnerChildRelativeLayout(activity); baseDialog = new Dialog(activity,android.R.style.Theme_DeviceDefault_Light_DialogWhenLarge_NoActionBar); baseDialog.getwindow().setBackgroundDrawable(new ColorDrawable(0x66000000)); //设置沉浸式状态栏 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WindowManager.LayoutParams localLayoutParams = baseDialog.getwindow().getAttributes(); localLayoutParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; localLayoutParams.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; } baseDialog.setContentView(layout); //设置dialog的窗口大小全屏 baseDialog.getwindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.MATCH_PARENT); //dialog关闭的时候移除所有消息 baseDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { handler.removeCallbacksAndMessages(null); if (ondismissListener != null) { baseDialog.setondismissListener(ondismissListener); } } }); //显示 baseDialog.show(); startSend(); return this; }
private void showMemoryLowDialog() { memoryLowDialog = new ErrorDialog(this,getString(R.string.memory_low_title),getString(R.string.memory_low_message)); memoryLowDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { ShowModuleActivity.this.finish(); } }); memoryLowDialog.show(); }
/** * 显示推荐话题的Dialog</br> */ private void showRecommendTopic() { if (mRecommendTopicFragment == null) { mRecommendTopicFragment = RecommendTopicFragment.newRecommendTopicFragment(); mRecommendTopicFragment.setSaveButtonInVisiable(); mRecommendTopicFragment.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { showFindPage(); } }); } showCommFragment(mRecommendTopicFragment); }
/** * 显示话题引导页面</br> */ private void showTopicFragment() { RecommendTopicFragment topicRecommendDialog =RecommendTopicFragment.newRecommendTopicFragment(); topicRecommendDialog.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { showRecommendUserFragment(); } }); addFragment(mContainer,topicRecommendDialog); }
/** * 显示推荐话题的Dialog</br> */ private void showRecommendTopic() { if (mRecommendTopicFragment == null) { mRecommendTopicFragment = RecommendTopicFragment.newRecommendTopicFragment(); mRecommendTopicFragment.setSaveButtonInVisiable(); mRecommendTopicFragment.setondismissListener(new OndismissListener() { @Override public void ondismiss(DialogInterface dialog) { showFindPage(); } }); } showCommFragment(mRecommendTopicFragment); }
android.text.method.DigitsKeyListener的实例源码
@Override protected void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); penClient = PenClientCtrl.getInstance( getApplicationContext() ); if(penClient.getProtocolVersion() == 1) addPreferencesFromresource( R.xml.pref_settings ); else addPreferencesFromresource( R.xml.pref_settings2 ); mPasswordPref = (EditTextPreference) getPreferenceScreen().findPreference( Const.Setting.KEY_PASSWORD ); EditText myEditText = (EditText) mPasswordPref.getEditText(); myEditText.setKeyListener( DigitsKeyListener.getInstance( false,true ) ); }
private void updateDropDownTextView() { if (dropDown != null) { if (currentPasswordType == 0) { dropDown.setText(LocaleController.getString("PasscodePIN",R.string.PasscodePIN)); } else if (currentPasswordType == 1) { dropDown.setText(LocaleController.getString("PasscodePassword",R.string.PasscodePassword)); } } if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) { InputFilter[] filterarray = new InputFilter[1]; filterarray[0] = new InputFilter.LengthFilter(4); passwordEditText.setFilters(filterarray); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890")); } else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setKeyListener(null); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
@Override public void setInputType(int type) { if (type == -1) { type = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD; } if (type == InputType.TYPE_CLASS_NUMBER || type == InputType.TYPE_NUMBER_FLAG_SIGNED || type == InputType.TYPE_NUMBER_FLAG_DECIMAL || type == InputType.TYPE_CLASS_PHONE) { final String symbolExceptions = getSymbolExceptions(); this.setKeyListener(DigitsKeyListener.getInstance("0123456789." + symbolExceptions)); } else { super.setInputType(type); } }
protected void updateInputMethod() { boolean hasNumberField = mNumberField != null; setEnabled(hasNumberField); if (hasNumberField) { int imeOptions = InputType.TYPE_CLASS_NUMBER; StringBuilder allowedChars = new StringBuilder("0123456789"); if (mAllowExponent) { allowedChars.append("e"); } if (mNumberField.getMinimumValue() < 0) { imeOptions |= InputType.TYPE_NUMBER_FLAG_SIGNED; allowedChars.append("-"); } if (!mNumberField.isInteger()) { imeOptions |= InputType.TYPE_NUMBER_FLAG_DECIMAL; allowedChars.append(mLocalizedDecimalSymbols.getDecimalSeparator()); } allowedChars.append(mLocalizedDecimalSymbols.getGroupingSeparator()); setImeOptions(imeOptions); setKeyListener(DigitsKeyListener.getInstance(allowedChars.toString())); } }
public void setMode(EditMode value) { m_editMode = value; switch (EffectiveMode()) { case HHMM: this.setHint(R.string.emptyWaterMarkHHMM); this.setInputType(InputType.TYPE_CLASS_NUMBER); setKeyListener(DigitsKeyListener.getInstance(false,false)); break; case INTEGER: this.setHint(R.string.emptyWaterMarkInt); this.setInputType(InputType.TYPE_CLASS_NUMBER); this.setKeyListener(DigitsKeyListener.getInstance(false,false)); // setKeyListener(DigitsKeyListener.getInstance("01234567890")); break; case DECIMAL: // See Android bug #2626 (http://code.google.com/p/android/issues/detail?id=2626&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars) // Using SetKeyListener this.setHint(String.format(Locale.getDefault(),"%.1f",0.0)); this.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); this.setKeyListener(DigitsKeyListener.getInstance(false,true)); // should work but bug above means it will ALWAYS use a period. break; } }
private void updateDropDownTextView() { if (dropDown != null) { if (currentPasswordType == 0) { dropDown.setText(LocaleController.getString("PasscodePIN",R.string.PasscodePassword)); } } if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) { InputFilter[] filterarray = new InputFilter[1]; filterarray[0] = new InputFilter.LengthFilter(4); passwordEditText.setFilters(filterarray); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890")); } else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setKeyListener(null); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); //Construct the preferences screen form XML config addPreferencesFromresource(R.xml.task_preferences); //Use the number keyboard when editing the time preference EditTextPreference timeDefault = (EditTextPreference)findPreference(getString(R.string.pref_default_time_from_Now_key)); timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance()); findPreference(this.getString(R.string.title_instructions)).setonPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(getActivity(),IntroActivity.class); startActivity(intent); return false; } }); }
public ExIntegerWidget(Context context,FormEntryPrompt prompt) { super(context,prompt); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED); // only allows numbers and no periods mAnswer.setKeyListener(new DigitsKeyListener(true,false)); // ints can only hold 2,147,483,648. we allow 999,999,999 InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(9); mAnswer.setFilters(fa); Integer i = getIntegerAnswerValue(); if (i != null) { mAnswer.setText(i.toString()); } }
private void setdiscoveryDelay() { final EditText input = new EditText(this); input.setHint(this.getString(R.string.hint_discoverydelay)); input.setText(Integer.toString(nfc.getdiscoveryDelay())); input.setInputType(EditorInfo.TYPE_CLASS_NUMBER); input.setKeyListener(DigitsKeyListener.getInstance("01234567890")); input.setSingleLine(true); SetDelayHelper helper = new SetDelayHelper(nfc,input); new AlertDialog.Builder(this,AlertDialog.THEME_HOLO_LIGHT) .setTitle(R.string.action_discoverydelay) .setMessage(R.string.lab_discoverydelay).setView(input) .setPositiveButton(R.string.action_ok,helper) .setNegativeButton(R.string.action_cancel,helper).show(); }
/** gets the key listener by type */ private static KeyListener getKeyListenerForType(NumericType type) { switch (type) { case DIALPAD: return new DialerKeyListener(); case INTEGER: return new DigitsKeyListener(); case SIGNED: return new DigitsKeyListener(true,false); case DECIMAL: return new DigitsKeyListener(true,true); case NONE: default: return null; } }
private void init(AttributeSet attrs,int defStyle) { // @formatter:off final TypedArray a = getContext().obtainStyledAttributes(attrs,R.styleable.PinputView,defStyle,0); // @formatter:on setFocusableInTouchMode(false); setKeyListener(DigitsKeyListener.getInstance(false,false)); mPinLen = a.getInt(R.styleable.PinputView_pinputview_len,4); mCharPadding = (int) a.getDimension(R.styleable.PinputView_pinputview_characterPadding,getResources().getDimension(R.dimen.pinputview_default_char_padding)); int foregroundColor = a.getColor(R.styleable.PinputView_pinputview_foregroundColor,Color.BLUE); int backgroundColor = a.getColor(R.styleable.PinputView_pinputview_backgroundColor,Color.GRAY); a.recycle(); initDrawables(foregroundColor,backgroundColor); initFilters(); initializeAnimator(); }
/** gets the key listener by type */ protected static KeyListener getKeyListenerForType(NumericType type) { switch (type) { case DIALPAD: return new DialerKeyListener(); case INTEGER: return new DigitsKeyListener(); case SIGNED: return new DigitsKeyListener(true,true); case NONE: default: return null; } }
public ExIntegerWidget(Context context,999 InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(9); mAnswer.setFilters(fa); Integer i = getIntegerAnswerValue(); if (i != null) { mAnswer.setText(i.toString()); } }
private void updateDropDownTextView() { if (dropDown != null) { if (currentPasswordType == 0) { dropDown.setText(LocaleController.getString("PasscodePIN",R.string.PasscodePassword)); } } if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) { InputFilter[] filterarray = new InputFilter[1]; filterarray[0] = new InputFilter.LengthFilter(4); passwordEditText.setFilters(filterarray); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890")); } else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) { passwordEditText.setFilters(new InputFilter[0]); passwordEditText.setKeyListener(null); passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); }
private void setEditable(boolean editable) { if (editable) { etInput.setFocusable(true); etInput.setKeyListener(new DigitsKeyListener()); } else { etInput.setFocusable(false); etInput.setKeyListener(null); } }
private void DynamicTimeSet(final SharedPreferences sp) { int num = sp.getInt("DynamicReloadTime",1000); LayoutInflater inflater = LayoutInflater.from(getActivity()); View view = inflater.inflate(R.layout.dialog_text,null); AlertDialog.Builder set = new AlertDialog.Builder(getActivity()); set.setTitle(R.string.xml_global_dynamicword_reload_time); final EditText et = (EditText) view.findViewById(R.id.dialog_text_edittext); et.setText(String.valueOf(num)); et.setKeyListener(new DigitsKeyListener(false,true)); set.setPositiveButton(R.string.done,new DialogInterface.OnClickListener() { public void onClick(DialogInterface d,int i) { String str = et.getText().toString(); if (!str.isEmpty()) { int get = Integer.valueOf(str); if (get < 500) { Toast.makeText(getActivity(),R.string.num_err,Toast.LENGTH_SHORT).show(); } else { sp.edit().putInt("DynamicReloadTime",get).apply(); Toast.makeText(getActivity(),R.string.restart_to_apply,Toast.LENGTH_LONG).show(); } } } }); set.setNegativeButton(R.string.cancel,null); set.setView(view); set.show(); }
private void setEditable(boolean editable) { if (editable) { mCount.setFocusable(true); mCount.setKeyListener(new DigitsKeyListener()); } else { mCount.setFocusable(false); mCount.setKeyListener(null); } }
private void initKeyboardButton(View view) { final Button toggleKeyboardButton = view.findViewById(R.id.toggleKeyboard); if(toggleKeyboardButton != null) { toggleKeyboardButton.setText("abc"); toggleKeyboardButton.setonClickListener(v -> { View focus = getActivity().getCurrentFocus(); if(focus != null && focus instanceof EditText) { EditText input = (EditText) focus; if ((input.getInputType() & InputType.TYPE_CLASS_NUMBER) != 0) { input.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); toggleKeyboardButton.setText("123"); } else { input.setInputType(InputType.TYPE_CLASS_NUMBER); input.setKeyListener(DigitsKeyListener.getInstance("0123456789.,- /")); toggleKeyboardButton.setText("abc"); } InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(input,InputMethodManager.SHOW_IMPLICIT); } }); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromresource(R.xml.task_preferences); // Set the time default to a numeric number only EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string.pref_default_time_from_Now_key)); timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance()); }
public ExDecimalWidget(Context context,prompt); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); // only allows numbers and no periods mAnswer.setKeyListener(new DigitsKeyListener(true,true)); // only 15 characters allowed InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(15); mAnswer.setFilters(fa); Double d = getDoubleAnswerValue(); // apparently an attempt at rounding to no more than 15 digit precision??? NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(15); nf.setMaximumIntegerDigits(15); nf.setGroupingUsed(false); if (d != null) { // truncate to 15 digits max... String dString = nf.format(d); d = Double.parseDouble(dString.replace(',','.')); // in case,is decimal pt mAnswer.setText(d.toString()); } }
public StringNumberWidget(Context context,FormEntryPrompt prompt,boolean readOnlyOverride) { super(context,prompt,readOnlyOverride,true); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontsize); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED); // needed to make long readonly text scroll mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false); mAnswer.setKeyListener(new DigitsKeyListener() { @Override protected char[] getAcceptedChars() { char[] accepted = { '0','1','2','3','4','5','6','7','8','9','.','-','+',' ',' }; return accepted; } }); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } String s = null; if (prompt.getAnswerValue() != null) s = (String) prompt.getAnswerValue().getValue(); if (s != null) { mAnswer.setText(s); } setupchangelistener(); }
public IntegerWidget(Context context,mAnswerFontsize); mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED); // needed to make long readonly text scroll mAnswer.setHorizontallyScrolling(false); mAnswer.setSingleLine(false); // only allows numbers and no periods mAnswer.setKeyListener(new DigitsKeyListener(true,999 InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(9); mAnswer.setFilters(fa); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } Integer i = getIntegerAnswerValue(); if (i != null) { mAnswer.setText(i.toString()); } setupchangelistener(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Construct the preferences screen from the XML config addPreferencesFromresource(R.xml.task_preferences); // Use the number keyboard when editing the time preference EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string .pref_default_time_from_Now_key)); timeDefault.getEditText().setKeyListener(DigitsKeyListener .getInstance()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); calculator_result = (TextView) findViewById(R.id.calculator_result); button_one = (Button) findViewById(R.id.number_one); button_two = (Button) findViewById(R.id.number_two); button_three = (Button) findViewById(R.id.number_three); button_four = (Button) findViewById(R.id.number_four); button_five = (Button) findViewById(R.id.number_five); button_six = (Button) findViewById(R.id.number_six); button_seven = (Button) findViewById(R.id.number_seven); button_eight = (Button) findViewById(R.id.number_eight); button_nine = (Button) findViewById(R.id.number_nine); button_zero = (Button) findViewById(R.id.number_zero); button_plus = (Button) findViewById(R.id.button_plus); button_minus = (Button) findViewById(R.id.button_minus); button_multiply = (Button) findViewById(R.id.button_multiply); button_divide = (Button) findViewById(R.id.button_divide); button_power = (Button) findViewById(R.id.button_power); button_root = (Button) findViewById(R.id.button_root); button_abs = (Button) findViewById(R.id.button_abs); button_clear = (Button) findViewById(R.id.button_clear); button_equals = (Button) findViewById(R.id.button_equals); calculator_result.setKeyListener(DigitsKeyListener.getInstance(true,true)); registerListeners(); }
@Override public void applyTextFilterIfNeeded(EditText e) { e.setInputType(InputType.TYPE_CLASS_NUMBER); e.setKeyListener(new DigitsKeyListener(true,false)); if (minimumValue != null && maximumValue != null) { setMinMaxFilterFor(e,minimumValue,maximumValue); } }
@Override public void applyTextFilterIfNeeded(EditText e) { e.setInputType(InputType.TYPE_CLASS_NUMBER); e.setKeyListener(new DigitsKeyListener(true,maximumValue); } }
public StringNumberWidget(Context context,boolean secret) { super(context,secret); mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP,mAnswerFontSize); mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT); // needed to make long readonly text scroll mAnswer.setHorizontallyScrolling(false); if (!secret) { mAnswer.setSingleLine(false); } mAnswer.setKeyListener(new DigitsKeyListener(true,true) { @Override protected char[] getAcceptedChars() { return new char[]{ '0',' ' }; } }); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } //This might be redundant,but I assume that it's about there being a difference //between a display value somewhere. We should double check if (prompt.getAnswerValue() != null) { String curAnswer = getCurrentAnswer().getValue().toString().trim(); try { mAnswer.setText(curAnswer); } catch (Exception NumberFormatException) { } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromresource(R.xml.graph_preferences); regressionLine = (CheckBoxPreference) findPreference(PREFERENCE_KEY_REGRESSION_LINE); regressionLineOrder = (EditTextPreference) findPreference(PREFERENCE_KEY_REGRESSION_LINE_ORDER); regressionLineOrder.getEditText().setKeyListener(new DigitsKeyListener()); updateGraPHPreferences(); initSummary(getPreferenceScreen()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromresource(R.xml.task_preferences); // Set the time default to a numeric number only EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string.pref_default_time_from_Now_key)); timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance()); }
private View createMeetingLengthTextBox() { meetingLengthEditText = new EditText(this); meetingLengthEditText.setGravity(Gravity.CENTER); meetingLengthEditText.setKeyListener(new DigitsKeyListener()); meetingLengthEditText.setRawInputType(InputType.TYPE_CLASS_PHONE); meetingLengthEditText.setLayoutParams(new LayoutParams(dipsToPixels(60),LayoutParams.WRAP_CONTENT)); meetingLengthEditText.setText(Integer.toString(meetingLength)); meetingLengthEditText.setLines(1); meetingLengthSpinner = null; return meetingLengthEditText; }
/** Sets the default values for the preference screen */ private void initPreferences() { // Binary file location EditTextPreference binaryFileLocation = (EditTextPreference) findPreference(Constants.PREFERENCE_STORAGE_DIRECTORY); if (TextUtils.isEmpty(binaryFileLocation.getText())) { binaryFileLocation.setText(EnvironmentUtil.getProcedureDirectory()); } // Image downscale factor EditTextPreference imageDownscale = (EditTextPreference) findPreference(Constants.PREFERENCE_IMAGE_SCALE); if (TextUtils.isEmpty(imageDownscale.getText())) { imageDownscale.setText("" + Constants.IMAGE_SCALE_FACTOR); } imageDownscale.getEditText().setKeyListener(new DigitsKeyListener()); // View all edu resources PreferenceScreen resourcePref = (PreferenceScreen) findPreference("s_education_resource"); Intent intent = EducationResourceList.getIntent(Intent.ACTION_PICK,Audience.ALL); intent.putExtra(Intent.EXTRA_INTENT,new Intent(Intent.ACTION_VIEW)); resourcePref.setIntent(intent); // SD card loading procedures PreferenceScreen intentPref = (PreferenceScreen) findPreference("s_procedures"); intentPref.setIntent(new Intent("org.sana.android.activity.IMPORT_PROCEDURE")); //intentPref.setIntent(new Intent(ResourceSettings.this,// ProcedureSdImporter.class)); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Construct the preferences screen from the XML config addPreferencesFromresource(R.xml.task_preferences); // Use the number keyboard when editing the time preference EditTextPreference timeDefault = (EditTextPreference) findPreference(getString(R.string .pref_default_time_from_Now_key)); timeDefault.getEditText().setKeyListener(DigitsKeyListener .getInstance()); }
public ExDecimalWidget(Context context,is decimal pt mAnswer.setText(d.toString()); } }
public StringNumberWidget(Context context,' }; return accepted; } }); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } String s = null; if (prompt.getAnswerValue() != null) s = (String) prompt.getAnswerValue().getValue(); if (s != null) { mAnswer.setText(s); } setupchangelistener(); }
public IntegerWidget(Context context,999 InputFilter[] fa = new InputFilter[1]; fa[0] = new InputFilter.LengthFilter(9); mAnswer.setFilters(fa); if (prompt.isReadOnly()) { setBackgroundDrawable(null); setFocusable(false); setClickable(false); } Integer i = getIntegerAnswerValue(); if (i != null) { mAnswer.setText(i.toString()); } setupchangelistener(); }
public NumberPicker(Context context,AttributeSet attrs,int defStyle) { super(context,attrs); setorientation(VERTICAL); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.number_picker,this,true); mHandler = new Handler(); mIncrementButton = (NumberPickerButton) findViewById(R.id.increment); mIncrementButton.setonClickListener(this); mIncrementButton.setonLongClickListener(this); mIncrementButton.setNumberPicker(this); mDecrementButton = (NumberPickerButton) findViewById(R.id.decrement); mDecrementButton.setonClickListener(this); mDecrementButton.setonLongClickListener(this); mDecrementButton.setNumberPicker(this); mText = (EditText) findViewById(R.id.timepicker_input); mText.setonFocuschangelistener(this); DigitsKeyListener keyListener = DigitsKeyListener.getInstance(false,true); mText.setFilters(new InputFilter[] { keyListener }); mText.setRawInputType(keyListener.getInputType()); if (!isEnabled()) { setEnabled(false); } }
@Override public void applyTextFilterIfNeeded(EditText e) { e.setInputType(InputType.TYPE_CLASS_NUMBER); e.setKeyListener(new DigitsKeyListener(true,maximumValue); } }
@Override public void applyTextFilterIfNeeded(EditText e) { e.setInputType(InputType.TYPE_CLASS_NUMBER); e.setKeyListener(new DigitsKeyListener(true,maximumValue); } }
C#中 Char.IsDigit() 和 Char.IsNumber() 的区别
Char.IsDigit()
C#和C#有什么区别Char.IsNumber()
?
关于人肉分析sorted(lst, key=lambda x: (x.isdigit(), x.isdigit() and int(x) % 2 == 0, x.islower(), x.isupp...的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于.gitignore for Visual Studio项目和解决方案 - .gitignore for Visual Studio Projects and Solutions、android.content.DialogInterface.OnDismissListener的实例源码、android.text.method.DigitsKeyListener的实例源码、C#中 Char.IsDigit() 和 Char.IsNumber() 的区别的相关信息,请在本站寻找。
本文标签: