@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wx_debug_activity); textBack = (TextView) findViewById(R.id.text_back); textScan = (ImageView) findViewById(R.id.text_scan); editHost = (EditText) findViewById(R.id.edit_host); editPort = (EditText) findViewById(R.id.edit_port); editOpen = (EditText) findViewById(R.id.edit_open); cbLocal = (CheckBox) findViewById(R.id.cb_local); cbDebugChrome = (CheckBox) findViewById(R.id.cb_debug_chrome); cbSRemote = (CheckBox) findViewById(R.id.cb_sRemoteDebugMode); btnSave = (Button) findViewById(R.id.btn_save); btnReset = (Button) findViewById(R.id.btn_save_reset); btnOpen = (Button) findViewById(R.id.btn_open); spinner = (Spinner) findViewById(R.id.spinner_log_level); textBack.setOnClickListener(this); textScan.setOnClickListener(this); btnSave.setOnClickListener(this); btnReset.setOnClickListener(this); btnOpen.setOnClickListener(this); setData(); hideSoftInput(); }
@Override public void onFinishInflate() { super.onFinishInflate(); mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group); mColorModeButtons.put(Theme.LIGHT, initializeAndGetButton(R.id.light_mode, Theme.LIGHT)); mColorModeButtons.put(Theme.DARK, initializeAndGetButton(R.id.dark_mode, Theme.DARK)); mColorModeButtons.put(Theme.SEPIA, initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA)); mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true); mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size); mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage); mFontFamilySpinner = (Spinner) findViewById(R.id.font_family); initFontFamilySpinner(); // Setting initial progress on font scale seekbar. onChangeFontScaling(mDistilledPagePrefs.getFontScaling()); mFontScaleSeekBar.setOnSeekBarChangeListener(this); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { log.i("onCreateView"); View rootView = inflater.inflate(R.layout.fragment_billing, container, false); txt_content = (TextView) rootView.findViewById(R.id.txt_content); txt_content.setText(this.getClass().getSimpleName()); bill_type = (Spinner) rootView.findViewById(R.id.bill_type); bill_sku = (Spinner) rootView.findViewById(R.id.bill_sku); String[] testSkus = getResources().getStringArray(R.array.bill_skus); for (String sku : testSkus) { mSkuList.add(sku); } mSkuAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, mSkuList); mSkuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); bill_sku.setAdapter(mSkuAdapter); return rootView; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityManager.getActivityManager().addActivity("RegisterActivity", this); setContentView(R.layout.activity_register); etName = (EditText) findViewById(R.id.ETname); etEmail = (EditText) findViewById(R.id.ETemail); spMajor = (Spinner) findViewById(R.id.spiMajor); spProvince = (Spinner) findViewById(R.id.spiProvince); etPassword = (EditText) findViewById(R.id.ETpassword); etConfirmPassword = (EditText) findViewById(R.id.ETconfirmPassword); etCheckCode = (EditText) findViewById(R.id.ETCheckCode); radioGroup = (RadioGroup) findViewById(R.id.rgGender); findViewById(R.id.butRegister).setOnClickListener(this); findViewById(R.id.butMailCode).setOnClickListener(this); }
public void doLookup() { setStatusText("initializing"); Session thisQuestion = new Session(); //build the question object String qname = gettxtQNAMEContent(); thisQuestion.qname = qname; thisQuestion.qtype = gettxtQTYPEContent(); thisQuestion.flag_RD = ((CheckBox) findViewById(R.id.cbRD)).isChecked(); thisQuestion.flag_CD = ((CheckBox) findViewById(R.id.cbCD)).isChecked(); thisQuestion.flag_DO = ((CheckBox) findViewById(R.id.cbDO)).isChecked(); thisQuestion.qclass = (((Spinner) findViewById(R.id.spinnerCLASS))).getSelectedItem().toString(); thisQuestion.server = gettxtResolverContent().trim(); thisQuestion.TCP = ((CheckBox) findViewById(R.id.cbTCP)).isChecked(); doLookup(thisQuestion); }
@Override protected void onFinishInflate() { super.onFinishInflate(); tvAmountA = (TextView) findViewById(R.id.tvAmountA); tvAmountB = (TextView) findViewById(R.id.tvAmountB); sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA); sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB); ArrayAdapter<String> btcAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, new String[]{"BTC"}); sCurrencyA.setAdapter(btcAdapter); sCurrencyA.setEnabled(false); ArrayAdapter<String> xmrAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, new String[]{"XMR"}); sCurrencyB.setAdapter(xmrAdapter); sCurrencyB.setEnabled(false); }
private void loadCommandSpinner(Spinner spinner, Command command) { AlertTypeItemSelectedListener listener = new AlertTypeItemSelectedListener(command); spinner.setOnItemSelectedListener(listener); List<String> list = new ArrayList<String>(); int defaultPos = 0; int pos = 0; for (String callableCommand : callableCommandNames) { int resourceId = getResources().getIdentifier(callableCommand, "string", getPackageName()); if (resourceId != 0) { list.add(getString(resourceId)); } else { list.add(callableCommand); } if (callableCommand.equals(command.getMethod())) { defaultPos = pos; } pos++; } ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter); spinner.setSelection(defaultPos); }
/** */ @Override protected void onInputViewChanged(@NonNull View inputView) { super.onInputViewChanged(inputView); if (!(inputView instanceof Spinner)) { throw new IllegalArgumentException("Only Spinner is allowed as input view for SpinnerLayout. Found(" + inputView + ") instead."); } this.mSpinner = (Spinner) inputView; if (mPrompt != null) { mSpinner.setPrompt(mPrompt); } if (mAdapter != null) { mSpinner.setAdapter(mAdapter); mSpinner.setSelection(mSelection, false); mSpinner.setOnItemSelectedListener(ITEM_SELECTED_LISTENER); this.updatePrivateFlags(PFLAG_ITEM_SELECTED_LISTENER_ATTACHED, true); } }
private void setupViews() { textInput_Code_user = (TextInputLayout) findViewById(R.id.textInput_Code_user); textInput_FullName = (TextInputLayout) findViewById(R.id.textInput_FullName); textInput_TelUsr = (TextInputLayout) findViewById(R.id.textInput_TelUsr); textInput_AdrUsr = (TextInputLayout) findViewById(R.id.textInput_AdrUsr); textView_Password1 = (TextInputLayout) findViewById(R.id.textView_Password1); textView_Password2 = (TextInputLayout) findViewById(R.id.textView_Password2); spinner_branch = (Spinner) findViewById(R.id.spinner_branch); Button button_register = (Button) findViewById(R.id.button_ajouter); button_register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(!checkFields()) Toast.makeText(RegisterActivity.this, "Erreur", Toast.LENGTH_SHORT).show(); else Register(); } }); }
private void getTeamObjects(){ mTeamManager = new TeamManager(); mTeamManager.getTeams(new IGetTeamsListener() { @Override public void onGetTeams(List<Team> retrievedTeams) { teamNames = new ArrayList<>(); teamIDS = new ArrayList<>(); team_spinner = (Spinner) findViewById(R.id.team_spinner); theTeams = retrievedTeams; createTeamSpinner(); } @Override public void onFailedTeams() { Toast.makeText(context, "Unable to retrieve teams.",Toast.LENGTH_LONG).show(); } }); }
private void setNumberType(View row, int type) { int position = 0; switch (type) { case ContactNumber.TYPE_CONTAINS: position = 1; break; case ContactNumber.TYPE_STARTS: position = 2; break; case ContactNumber.TYPE_ENDS: position = 3; break; } Spinner numberTypeSpinner = (Spinner) row.findViewById(R.id.spinner_number_type); numberTypeSpinner.setSelection(position); }
@NonNull private PaymentSetupRequest buildPaymentRequest(final View view) throws ParseException { Log.v(TAG, "buildPaymentRequest()"); PaymentSetupRequest paymentSetupRequest = new PaymentSetupRequest(); paymentSetupRequest.setMerchantAccount(((EditText) view.findViewById(R.id.merchantAccountEntry)).getText() .toString()); final String amountValueString = ((EditText) view.findViewById(R.id.orderAmountEntry)).getText().toString(); final String amountCurrencyString = ((EditText) view.findViewById(R.id.orderCurrencyEntry)) .getText().toString(); paymentSetupRequest.setAmount(new Amount(AmountUtil.parseMajorAmount(amountCurrencyString, amountValueString), amountCurrencyString)); paymentSetupRequest.setCountryCode(((EditText) view.findViewById(R.id.countryEntry)).getText().toString()); paymentSetupRequest.setShopperLocale(((EditText) view.findViewById(R.id.shopperLocaleEntry)).getText().toString()); paymentSetupRequest.setShopperReference(((EditText) view.findViewById(R.id.shopperReferenceEntry)).getText() .toString()); paymentSetupRequest.setReference(((EditText) view.findViewById(R.id.referenceEntry)).getText() .toString()); String maxNumberOfInstallments = ((String) ((Spinner) view.findViewById(R.id.installmentsEntry)).getSelectedItem()); paymentSetupRequest.setMaxNumberOfInstallments(maxNumberOfInstallments); return paymentSetupRequest; }
private void editIssue(View v) { int categoryId = ((Spinner) findViewById(R.id.nameCategorySpinner)) .getSelectedItemPosition(); final View vi = v; mCategory = Category.values()[categoryId]; mIssueAdapter.editIssue(mIssue.getIssueAuthToken(), getUpdatedFields(), new IssueSimpleCallback() { @Override public void onSuccess(Issue issue) { Intent intent = new Intent(); Bundle data = new Bundle(); data.putSerializable(TAG_ISSUE, issue); intent.putExtra(TAG_ISSUE, data); setResult(RESULT_OK, intent); finish(); } @Override public void onFailure() { Snackbar.make(vi, R.string.couldnt_edit_issue, Snackbar.LENGTH_SHORT) .show(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_play_movie); mTextureView = (TextureView) findViewById(R.id.movie_texture_view); mTextureView.setSurfaceTextureListener(this); // Populate file-selection spinner. Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner); // Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout // for the widget itself. mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4"); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mMovieFiles); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner. spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); updateControls(); }
@Override protected void initUI() { mContext = this; mBtnGetReport = (Button) findViewById(R.id.btn_get_reports); chartContainer = (LinearLayout) findViewById(R.id.report_chart_view_container); reportContainer = (LinearLayout) findViewById(R.id.report_container); deviceMessage = (TextView) findViewById(R.id.device_message); mTvToDate = (TextView) findViewById(R.id.btn_to); //deviceNameText = (TextView) findViewById(R.id.deviceName); mDeviceSpin = (Spinner) findViewById(R.id.device_spin); mDataSpin = (Spinner) findViewById(R.id.data_spin); mllGetReport = (LinearLayout) findViewById(R.id.btn_get_reports_ll); mTvToDate.setOnClickListener(this); mllGetReport.setOnClickListener(this); mBtnGetReport.setOnClickListener(this); mDeviceSpin.setOnItemSelectedListener(this); mDataSpin.setOnItemSelectedListener(this); }
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); mEnabledCheckbox = (CheckBox) view.findViewById(R.id.increasing_ring); mEnabledCheckbox.setOnCheckedChangeListener(this); mMinVolumeTitle = (TextView) view.findViewById(R.id.increasing_ring_min_volume_title); mMinVolumeSeekBar = (SeekBar) view.findViewById(R.id.seekbar); AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE); mMinVolumeSeekBar.setSecondaryProgress(am.getStreamVolume(AudioManager.STREAM_RING)); mRingVolumeNotice = (TextView) view.findViewById(R.id.increasing_ring_volume_notice); mIntervalTitle = (TextView) view.findViewById(R.id.increasing_ring_ramp_up_duration_title); mInterval = (Spinner) view.findViewById(R.id.increasing_ring_ramp_up_duration); mIntervalValues = getContext().getResources().getIntArray(R.array.increasing_ring_ramp_up_duration_values); getConfig(); updateVolumeNoticeVisibility(mMinVolumeSeekBar.getProgress()); updateEnabledStates(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_habit_event); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // IOManager.initManager(this.getApplicationContext()); // ActivityCompat.requestPermissions(this, // new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, // REQUEST_LOCATION); spinner = (Spinner) findViewById(R.id.habitTypeSpinner); eventTitle = (EditText) findViewById(R.id.eventTitle); eventComment = (EditText) findViewById(R.id.eventComment); photoImageButton = (ImageButton) findViewById(R.id.imageButtonPhoto); initListeners(); }
@Override public void onDataChange(DataSnapshot dataSnapshot) { EditText username = (EditText)findViewById(R.id.usernameText); name = username.getText().toString(); EditText password = (EditText)findViewById(R.id.passwordText); pass = password.getText().toString(); Spinner grabAccountType = findViewById(R.id.accountTypeSpinner); String accountType = (String) grabAccountType.getSelectedItem(); if (!(dataSnapshot.child(email).hasChild(name))) { if (accountType.equals("Child")) { newUser = new User(name, pass, MenuActivity.getManager().nextSerialNumber(), resID); manager.setCurrentUserId(newUser.getUserId()); manager.addRegUser(newUser); fbRef.child(email).child("ChoreManager").setValue(manager); } else { newAdminUser = new AdminUser(name, pass, MenuActivity.getManager().nextSerialNumber(), resID); manager.setCurrentUserId(newAdminUser.getUserId()); manager.addAdminUser(newAdminUser); fbRef.child(email).child("ChoreManager").setValue(manager); } } finish(); }
public void inject(Finder finder, T target, Object source) { target.lineChart = (LineChartView) finder.castView((View) finder.findRequiredView(source, R.id.linechart, "field 'lineChart'"), R.id.linechart, "field 'lineChart'"); target.rg_weight = (RadioGroup) finder.castView((View) finder.findRequiredView(source, R .id.rg_weight, "field 'rg_weight'"), R.id.rg_weight, "field 'rg_weight'"); target.spinner = (Spinner) finder.castView((View) finder.findRequiredView(source, R.id .spinner, "field 'spinner'"), R.id.spinner, "field 'spinner'"); target.ll_content = (LinearLayout) finder.castView((View) finder.findRequiredView(source, R.id.ll_content, "field 'll_content'"), R.id.ll_content, "field 'll_content'"); }
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) { final SpinnerAdapter adapter = spinner.getAdapter(); final int count = adapter.getCount(); for (int i = 0; i < count; i++) { final Object item = spinner.getItemAtPosition(i); if (item.equals(itemToSelect)) { spinner.setSelection(i); return; } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_banner_style); banner = (Banner) findViewById(R.id.banner); spinnerStyle = (Spinner) findViewById(R.id.spinnerStyle); spinnerStyle.setOnItemSelectedListener(this); //默认是CIRCLE_INDICATOR banner.setImages(App.images) .setBannerTitles(App.titles) .setBannerStyle(BannerConfig.NOT_INDICATOR) .setImageLoader(new GlideImageLoader()) .start(); }
public void startClick(View v) { TestParams params = new TestParams(); Spinner spinnerThread = (Spinner) findViewById(R.id.spinnerThread); String threadModeStr = spinnerThread.getSelectedItem().toString(); ThreadMode threadMode = ThreadMode.valueOf(threadModeStr); params.setThreadMode(threadMode); params.setEventInheritance(((CheckBox) findViewById(R.id.checkBoxEventBusEventHierarchy)).isChecked()); params.setIgnoreGeneratedIndex(((CheckBox) findViewById(R.id.checkBoxEventBusIgnoreGeneratedIndex)).isChecked()); EditText editTextEvent = (EditText) findViewById(R.id.editTextEvent); params.setEventCount(Integer.parseInt(editTextEvent.getText().toString())); EditText editTextSubscriber = (EditText) findViewById(R.id.editTextSubscribe); params.setSubscriberCount(Integer.parseInt(editTextSubscriber.getText().toString())); Spinner spinnerTestToRun = (Spinner) findViewById(R.id.spinnerTestToRun); int testPos = spinnerTestToRun.getSelectedItemPosition(); params.setTestNumber(testPos + 1); ArrayList<Class<? extends Test>> testClasses = initTestClasses(testPos); params.setTestClasses(testClasses); Intent intent = new Intent(); intent.setClass(this, TestRunnerActivity.class); intent.putExtra("params", params); startActivity(intent); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mLoader = (ButtonProgressBar) findViewById(R.id.cl_main); mLoaderTypeSp = (Spinner) findViewById(R.id.sp_select_type); init(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loadmore); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view); doURV(ultimateRecyclerView); bButtons(); ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1); setupSpinnerSelection((Spinner) findViewById(R.id.spinner), spinnerAdapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_colors); mColorScheme = HostDatabase.DEFAULT_COLOR_SCHEME; mHostDb = HostDatabase.get(this); mColorList = mHostDb.getColorsForScheme(mColorScheme); mDefaultColors = mHostDb.getDefaultColorsForScheme(mColorScheme); mColorGrid = (GridView) findViewById(R.id.color_grid); mColorGrid.setAdapter(new ColorsAdapter(true)); mColorGrid.setOnItemClickListener(this); mColorGrid.setSelection(0); mFgSpinner = (Spinner) findViewById(R.id.fg); mFgSpinner.setAdapter(new ColorsAdapter(false, R.string.colors_fg_label)); mFgSpinner.setSelection(mDefaultColors[0]); mFgSpinner.setOnItemSelectedListener(this); mBgSpinner = (Spinner) findViewById(R.id.bg); mBgSpinner.setAdapter(new ColorsAdapter(false, R.string.color_bg_label)); mBgSpinner.setSelection(mDefaultColors[1]); mBgSpinner.setOnItemSelectedListener(this); }
public TemplateListAdapter(Context context, View view, int resource) { mView = view; mSpinner = (Spinner) view.findViewById(R.id.spTemplate); // Get restriction categories TreeMap<String, String> tmRestriction = PrivacyManager.getRestrictions(context); listRestrictionName = new ArrayList<String>(tmRestriction.values()); listLocalizedTitle = new ArrayList<String>(tmRestriction.navigableKeySet()); int userId = Util.getUserId(Process.myUid()); ondemand = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingOnDemand, true); version = new Version(Util.getSelfVersionName(context)); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { // Get the animation container final ImageView imageView = (ImageView) view.findViewById(R.id.animation_container); mFrameInformationContainer = (LinearLayout) view.findViewById(R.id.frame_information); mAnimatedDrawable = new AnimatedDrawable2(); mAnimatedDrawable.setDrawListener(new AnimatedDrawable2DebugDrawListener()); view.findViewById(R.id.invalidate_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.invalidate(); } }); mAnimationControlsManager = new AnimationControlsManager( mAnimatedDrawable, (SeekBar) getView().findViewById(R.id.seekbar), (ToggleButton) getView().findViewById(R.id.playpause), getView().findViewById(R.id.reset)); new BitmapAnimationCacheSelectorConfigurator( (Spinner) view.findViewById(R.id.spinner), mBitmapFrameCacheChangedListener, mFrameCacheListener); imageView.setImageDrawable(mAnimatedDrawable); }
public void fillFret(View view, TGNote note) { int selection = 0; if( note != null ) { selection = (note.getEffect().isGrace() ? note.getEffect().getGrace().getFret() : note.getValue()); } ArrayAdapter<TGSelectableItem> adapter = new ArrayAdapter<TGSelectableItem>(getActivity(), android.R.layout.simple_spinner_item, createFretValues()); Spinner spinner = (Spinner) view.findViewById(R.id.grace_dlg_fret_value); spinner.setAdapter(adapter); spinner.setSelection(adapter.getPosition(new TGSelectableItem(Integer.valueOf(selection), null))); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView versionInfoTextView = (TextView) findViewById(R.id.VersionInfoTextView); String info = "版本号:" + getVersionDescription() + ",编译时间:" + getBuildTimeDescription(); versionInfoTextView.setText(info); mPreviewSizeRatioSpinner = (Spinner) findViewById(R.id.PreviewSizeRatioSpinner); mPreviewSizeLevelSpinner = (Spinner) findViewById(R.id.PreviewSizeLevelSpinner); mEncodingModeLevelSpinner = (Spinner) findViewById(R.id.EncodingModeLevelSpinner); mEncodingSizeLevelSpinner = (Spinner) findViewById(R.id.EncodingSizeLevelSpinner); mEncodingBitrateLevelSpinner = (Spinner) findViewById(R.id.EncodingBitrateLevelSpinner); ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.PREVIEW_SIZE_RATIO_TIPS_ARRAY); mPreviewSizeRatioSpinner.setAdapter(adapter); adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.PREVIEW_SIZE_LEVEL_TIPS_ARRAY); mPreviewSizeLevelSpinner.setAdapter(adapter); mPreviewSizeLevelSpinner.setSelection(3); adapter= new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_MODE_LEVEL_TIPS_ARRAY); mEncodingModeLevelSpinner.setAdapter(adapter); mEncodingModeLevelSpinner.setSelection(0); adapter= new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_SIZE_LEVEL_TIPS_ARRAY); mEncodingSizeLevelSpinner.setAdapter(adapter); mEncodingSizeLevelSpinner.setSelection(7); adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, RecordSettings.ENCODING_BITRATE_LEVEL_TIPS_ARRAY); mEncodingBitrateLevelSpinner.setAdapter(adapter); mEncodingBitrateLevelSpinner.setSelection(2); }
private void log(int number, Spinner typeSpinner) { String type = typeSpinner.getSelectedItem().toString(); String logType = (String)type.toLowerCase().subSequence(0, 1); switch(logType){ case "Error": logType = "e"; case "Debug": logType = "d"; case "Info": logType = "i"; case "Verbose": logType = "v"; case "Warning": logType = "w"; default: logType = "d"; } try { Method method = Log.class.getMethod(logType, String.class, String.class); long startTime = System.currentTimeMillis(); for(int i = 1; i < number; i++) { method.invoke(Log.class, "TestApp", "This is a log message: " + i); } long endTime = System.currentTimeMillis(); String message = "Logging " + number + " messages took " + (endTime - startTime) + " Milliseconds"; Log.i("TestApp", message); Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show(); } catch(Exception e) { Log.e("TestApp", "Exception:", e); } }
/** @return The validatable item for the given view. */ private EditorFieldView getEditorTextField(View v) { if (v instanceof TextView && v.getParent() != null && v.getParent() instanceof EditorFieldView) { return (EditorFieldView) v.getParent(); } else if (v instanceof Spinner && v.getTag() != null) { return (EditorFieldView) v.getTag(); } else { return null; } }
@Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { Spinner spinner = (Spinner) parent; final int filterNum = spinner.getSelectedItemPosition(); Log.d(TAG, "onItemSelected: " + filterNum); mGLView.queueEvent(new Runnable() { @Override public void run() { // notify the renderer that we want to change the encoder's state mRenderer.changeFilterMode(filterNum); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.slice_upload_json).setOnClickListener(this); findViewById(R.id.upload_normal_json).setOnClickListener(this); Button mSliceUploadButton = (Button) findViewById(R.id.slice_upload); mSliceUploadButton.setOnClickListener(this); Button mCancelRequestButton = (Button) findViewById(R.id.cancel_requests); mCancelRequestButton.setOnClickListener(this); Button mGenerateFilesButton = (Button) findViewById(R.id.generate_files); mGenerateFilesButton.setOnClickListener(this); Button mUploadNormalButton = (Button) findViewById(R.id.upload_normal); mUploadNormalButton.setOnClickListener(this); findViewById(R.id.multi_upload_normal).setOnClickListener(this); Button clearFileBtn = (Button) findViewById(R.id.clear_files_btn); clearFileBtn.setOnClickListener(this); mBaseUrlEt = (EditText) findViewById(R.id.baseurl_et); mTokenEt = (EditText) findViewById(R.id.token_et); mKeyEt = (EditText) findViewById(R.id.keyname_et); mFilenameEt = (EditText) findViewById(R.id.filename_et); mMimeTypeEt = (EditText) findViewById(R.id.mimetype_et); mSliceEt = (EditText) findViewById(R.id.slice_size_et); mBlockEt = (EditText) findViewById(R.id.block_size_et); mDisplayTv = (TextView) findViewById(R.id.display_tv); mDisplaySv = (ScrollView) findViewById(R.id.display_scrollview); mFileSizeSp = (Spinner) findViewById(R.id.file_size_sp); setSpAdapter(); init(); }
void initViewsDialogNew(View v) { ServerDatabaseHandler dbHandler = ServerDatabaseHandler.getInstance(getActivity()); if (dbHandler.isThereAnyCertificatesInDatabase()){ certificateSpinner = (Spinner) v.findViewById(R.id.certificateSpinner); List<CertificateSpinnerItem> spinnerList = dbHandler.getSpinnerList(); spinnerList.add(0, new CertificateSpinnerItem(){ @Override public String toString(){ return getString(R.string.spinner_choose_certificate); } }); pairingInfoTextView.setVisibility(View.GONE); initiatePairingButton.setText(R.string.dialog_pairing_button_text_or); ArrayAdapter<CertificateSpinnerItem> spinnerArrayAdapter = new ArrayAdapter<>( getActivity().getApplicationContext(), R.layout.dialog_certificate_spinner_textview, spinnerList); spinnerArrayAdapter.setDropDownViewResource(R.layout.dialog_certificate_spinner_dropdown_textview); certificateSpinner.setAdapter(spinnerArrayAdapter); certificateSpinner.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); certificateSpinner.setOnTouchListener(this); certificateSpinner.setOnItemSelectedListener(this); } else { v.findViewById(R.id.certificateSpinner).setVisibility(View.GONE); } v.findViewById(R.id.deleteServerBtn).setVisibility(View.INVISIBLE); dbHandler.close(); }
private void setupSpinner() { Spinner spinner = findViewById(R.id.spinner); spinner.setOnItemSelectedListener(mMainItemSelected); List<String> categories = new ArrayList<>(); categories.add("All"); categories.add("Photos"); categories.add("Videos"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(dataAdapter); Spinner spinnerFilter = findViewById(R.id.spinnerFilter); spinnerFilter.setOnItemSelectedListener(mFilterItemSelected); List<String> filter = new ArrayList<>(); filter.add("CLUSTER BY ALBUM"); filter.add("CLUSTER BY TIME"); filter.add("CLUSTER BY LOCATION"); filter.add("CLUSTER BY TAG"); filter.add("CLUSTER BY SIZE"); filter.add("CLUSTER BY FACE"); ArrayAdapter<String> dataAdapterFilter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, filter); dataAdapterFilter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerFilter.setAdapter(dataAdapterFilter); }
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Spinner spinnerTimer = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_timer); final Spinner spinnerWhen = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_when); final Spinner spinnerColors = (Spinner) view.findViewById(R.id.fragment_components_menus_spinner_colors); final SpinnerLayout spinnerLayoutTimer = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_timer); final SpinnerLayout sSpinnerLayoutWhen = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_when); final SpinnerLayout spinnerLayoutColors = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors); final SpinnerLayout spinnerLayoutColorsDisabled = (SpinnerLayout) view.findViewById(R.id.fragment_components_menus_spinner_layout_colors_disabled); final Context context = getActivity(); spinnerTimer.setAdapter(new TimerAdapter(context)); spinnerTimer.setSelection(2, false); spinnerTimer.setOnItemSelectedListener(this); spinnerWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN)); spinnerWhen.setSelection(0, false); spinnerWhen.setOnItemSelectedListener(this); spinnerColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS)); spinnerColors.setSelection(0, false); spinnerColors.setOnItemSelectedListener(this); spinnerLayoutTimer.setAdapter(new TimerAdapter(context)); spinnerLayoutTimer.setSelection(2, false); spinnerLayoutTimer.setOnItemSelectedListener(this); sSpinnerLayoutWhen.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, WHEN)); sSpinnerLayoutWhen.setOnItemSelectedListener(this); spinnerLayoutColors.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS)); spinnerLayoutColors.setOnItemSelectedListener(this); spinnerLayoutColorsDisabled.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, COLORS)); }
private boolean isValid() { boolean ret = true; int max = scrollView.getChildCount(); for (int i = 0; i < max; i++) { Spinner spiner = (Spinner) scrollView.getChildAt(i); if (spiner.getSelectedItem() == null) { ret = false; } } return ret; }
public int getTimeSpanAmount() { Spinner timeSpanSpinner = (Spinner) dialog.findViewById(R.id.timeSpanSpinner); if (timeSpanSpinner == null) { return -1; } Editable text = timeSpanEditText.getText(); String timeSpanAmountString = null; if (text != null) { timeSpanAmountString = text.toString(); } int timeSpanAmount = 0; if (timeSpanAmountString != null && !"".equals(timeSpanAmountString)) { timeSpanAmount = Integer.parseInt(timeSpanAmountString); } return timeSpanAmount; }
public void restorePreferences(Activity activity, SharedPreferences preferences) { Spinner decimals = (Spinner)activity.findViewById(R.id.spinnerDecimals); Spinner decimalSeparators = (Spinner)activity.findViewById(R.id.spinnerDecimalSeparators); Spinner groupSeparators = (Spinner)activity.findViewById(R.id.spinnerGroupSeparators); decimals.setSelection(preferences.getInt(prefix(EXPORT_DECIMALS), 0)); decimalSeparators.setSelection(preferences.getInt(prefix(EXPORT_DECIMAL_SEPARATOR), 0)); groupSeparators.setSelection(preferences.getInt(prefix(EXPORT_GROUP_SEPARATOR), 3)); }
public static void populateClientSpinner(final Context context, final Spinner spinnerClients , final CompositeDisposable compositeDisposable) { ClientsNetworkCalls.getAllClients().subscribe(new Observer<List<Client>>() { @Override public void onSubscribe(Disposable d) { compositeDisposable.add(d); } @Override public void onNext(List<Client> value) { ArrayList<String> date = new ArrayList<>(); for (Client client : value) { date.add(String.valueOf(client.getNameClt())); } ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, date); spinnerClients.setAdapter(adapter); } @Override public void onError(Throwable e) { Log.e("Get Clients" , "Error getting clients" , e); if(e instanceof SocketException || e instanceof IOException) { Toast.makeText(context , R.string.no_internet , Toast.LENGTH_SHORT).show(); } else if (e instanceof Exception) { Toast.makeText(context , e.getMessage() , Toast.LENGTH_LONG).show(); } } @Override public void onComplete() { } }); }