List of usage examples for android.widget Spinner setAdapter
@Override public void setAdapter(SpinnerAdapter adapter)
From source file:org.alfresco.mobile.android.application.widgets.DocumentFolderPickerFragment.java
private void refreshSpinners() { // UPLOAD FOLDER Spinner spinner = (Spinner) rootView.findViewById(R.id.import_folder_spinner); UploadFolderAdapter upLoadadapter = null; if (getActivity() instanceof FolderShortcutActivity) { upLoadadapter = new UploadFolderAdapter(getActivity(), R.layout.row_single_line, FOLDER_SHORTCUT_LIST); } else {/* w w w . j a v a 2s. com*/ upLoadadapter = new UploadFolderAdapter(getActivity(), R.layout.row_single_line, FOLDER_ACTIONS_LIST); } spinner.setAdapter(upLoadadapter); spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { rootFolderTypeId = (Integer) parent.getItemAtPosition(pos); rootFolderTypeIndex = pos; } @Override public void onNothingSelected(AdapterView<?> arg0) { // DO Nothing } }); if (rootFolderTypeId == null) { rootFolderTypeIndex = 0; } spinner.setSelection(rootFolderTypeIndex); // ACTIONS ASSOCIATED if (getActivity() instanceof FolderShortcutActivity) { rootView.findViewById(R.id.actions_spinner_title).setVisibility(View.GONE); rootView.findViewById(R.id.actions_spinner).setVisibility(View.GONE); return; } spinner = (Spinner) rootView.findViewById(R.id.actions_spinner); ActionShortcutAdapter actionAdapter = new ActionShortcutAdapter(getActivity(), R.layout.row_single_line, ACTIONS_LIST); spinner.setAdapter(actionAdapter); spinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { actionId = (Integer) parent.getItemAtPosition(pos); actionIdIndex = pos; } @Override public void onNothingSelected(AdapterView<?> arg0) { // DO Nothing } }); if (actionId == null) { actionIdIndex = 0; } spinner.setSelection(actionIdIndex); }
From source file:com.example.amit.tellymoviebuzzz.ImdbUpcomingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The CursorAdapter will take data from our cursor and populate the ListView. mForecastAdapter = new ImdbUpcomingAdapter(getActivity(), null, 0); View rootView = inflater.inflate(R.layout.imdbupcoming_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.listview_imdbupcoming_movies); listView.setAdapter(mForecastAdapter); final String[] str1 = { "Action", "Adventure", "Animation", "Comedy", "Crime", "Documentary", "Drama", "Family", "Fantasy", "Foreign", "History", "Horror", "Music", "Mystery", "Romance", "Science Fiction", "TV Movie", "Thriller", "War", "Western", "Others" }; Spinner sp2 = (Spinner) rootView.findViewById(R.id.spinnerupcomingyear); //final Spinner sp2= (Spinner) findViewById(R.id.spinner2); ArrayAdapter<String> adp2 = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, str1);/*from w w w .j ava 2s . c om*/ adp2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sp2.setAdapter(adp2); sp2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) { // TODO Auto-generated method stub // Toast.makeText(getBaseContext(),list.get(position), Toast.LENGTH_SHORT).show(); String val = str1[position]; Bundle bund = new Bundle(); bund.putString("choice", val); // bund. getLoaderManager().restartLoader(FORECAST_LOADER, bund, ImdbUpcomingFragment.this); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); // Spinner spinner = (Spinner) rootView.findViewById(R.id.spinnerthisyear); /// String[] options = {"India","USA","UK"}; // android.R.layout.support_simple_spinner_dropdown_item // We'll call our MainActivity listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { // CursorAdapter returns a cursor at the correct position for getItem(), or null // if it cannot seek to that position. Cursor cursor = (Cursor) adapterView.getItemAtPosition(position); if (cursor != null) { // String locationSetting = Utility.getPreferredLocation(getActivity()); String movieSetting = "thisyear"; //Utility.getPreferredMovie(getActivity()); // Intent intent = new Intent(getActivity(), DetailActivity.class) // .setData(WeatherContract.WeatherEntry.buildWeatherLocationWithDate( // locationSetting, cursor.getLong(COL_WEATHER_DATE) // )); // Intent intent = new Intent(getActivity(), DetailActivity.class) // .setData(MovieContract.MovieNumberEntry.buildMovieTypeWithMovieId(movieSetting, cursor.getString(COL_MOVIE_SETTING))); Intent intent = new Intent(getActivity(), DetailActivity.class); // .setData(cursor.getString(ImdbUpcomingFragment.COL_TMDBID)); intent.putExtra("movieid", cursor.getString(ImdbUpcomingFragment.COL_TMDBID)); startActivity(intent); } } }); return rootView; }
From source file:com.carver.paul.truesight.Ui.CounterPicker.CounterPickerFragment.java
private void setupRolesSpinner(LayoutInflater inflater, View inflateView) { Spinner spinner = (Spinner) inflateView.findViewById(R.id.spinner_counter_picker); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(inflater.getContext(), R.array.roles_array, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); }
From source file:hku.fyp14017.blencode.content.bricks.BroadcastReceiverBrick.java
@Override public View getView(final Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; }//from w ww . j av a 2 s . c o m if (view == null) { alphaValue = 255; } if (receiveScript == null) { receiveScript = new BroadcastScript(broadcastMessage); MessageContainer.addMessage(getBroadcastMessage()); } view = View.inflate(context, hku.fyp14017.blencode.R.layout.brick_broadcast_receive, null); view = getViewWithAlpha(alphaValue); setCheckboxView(hku.fyp14017.blencode.R.id.brick_broadcast_receive_checkbox); // XXX method moved to to DragAndDropListView since it is not working on 2.x // checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { // // @Override // public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // checked = isChecked; // if (!checked) { // for (Brick currentBrick : adapter.getCheckedBricks()) { // currentBrick.setCheckedBoolean(false); // } // } // adapter.handleCheck(brickInstance, checked); // } // }); final Spinner broadcastSpinner = (Spinner) view .findViewById(hku.fyp14017.blencode.R.id.brick_broadcast_receive_spinner); broadcastSpinner.setFocusableInTouchMode(false); broadcastSpinner.setFocusable(false); if (!(checkbox.getVisibility() == View.VISIBLE)) { broadcastSpinner.setClickable(true); broadcastSpinner.setEnabled(true); } else { broadcastSpinner.setClickable(false); broadcastSpinner.setEnabled(false); } broadcastSpinner.setAdapter(MessageContainer.getMessageAdapter(context)); broadcastSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String selectedMessage = broadcastSpinner.getSelectedItem().toString(); if (selectedMessage .equals(context.getString(hku.fyp14017.blencode.R.string.new_broadcast_message))) { showNewMessageDialog(broadcastSpinner); } else { receiveScript.setBroadcastMessage(selectedMessage); broadcastMessage = selectedMessage; } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); setSpinnerSelection(broadcastSpinner); return view; }
From source file:no.ntnu.idi.socialhitchhiking.map.MapActivityJourney.java
/** * sends a message to the driver of a journey *///from ww w. j a v a 2 s . co m private void sendMessageToDriver() { final Dialog customDialog = new Dialog(this); customDialog.setContentView(R.layout.custom_dialog_layout); customDialog.setTitle("Message"); final List<String> spinnerArray = new ArrayList<String>(); spinnerArray.add("Everyone"); if (!getApp().getSelectedJourney().getDriver().equals(getApp().getUser())) { spinnerArray.add(getApp().getSelectedJourney().getDriver().getFullName()); } for (int i = 0; i < getApp().getSelectedJourney().getHitchhikers().size(); i++) { if (!getApp().getSelectedJourney().getHitchhikers().get(i).equals(getApp().getUser())) { spinnerArray.add(getApp().getSelectedJourney().getHitchhikers().get(i).getFullName()); } } final Spinner spinner = (Spinner) customDialog.findViewById(R.id.spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(MapActivityJourney.this, android.R.layout.simple_spinner_item, spinnerArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); ImageView sendBtn = (ImageView) customDialog.findViewById(R.id.sendBtn); final EditText input = (EditText) customDialog.findViewById(R.id.input); sendBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { User mid = getApp().getUser(); if (spinner.getSelectedItem().toString().equals("Everyone")) { if (input.getText().toString().equals("")) { input.setHint("Please fill in your message"); Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); } else { List<User> userList = new ArrayList<User>(); userList.add(getApp().getSelectedJourney().getDriver()); for (int k = 0; k < getApp().getSelectedJourney().getHitchhikers().size(); k++) { userList.add(getApp().getSelectedJourney().getHitchhikers().get(k)); } userList.remove(getApp().getUser()); for (int k = 0; k < userList.size(); k++) { sendMessage(userList.get(k), input); } Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); customDialog.dismiss(); } } else { for (int j = 0; j < getApp().getSelectedJourney().getHitchhikers().size(); j++) { if (spinner.getSelectedItem().toString() .equals(getApp().getSelectedJourney().getHitchhikers().get(j).getFullName())) { mid = getApp().getSelectedJourney().getHitchhikers().get(j); } } if (spinner.getSelectedItem().toString() .equals(getApp().getSelectedJourney().getDriver().getFullName())) { mid = getApp().getSelectedJourney().getDriver(); } if (input.getText().toString().equals("")) { input.setHint("Please fill in your message"); Toast toast = Toast.makeText(MapActivityJourney.this, "Please fill in your message", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); } else { sendMessage(mid, input); Toast toast = Toast.makeText(MapActivityJourney.this, "Message sent", Toast.LENGTH_SHORT); toast.setGravity(Gravity.BOTTOM, toast.getXOffset() / 2, toast.getYOffset() / 2); toast.show(); customDialog.dismiss(); } } } }); customDialog.show(); }
From source file:au.org.ala.fielddata.mobile.SurveyBuilder.java
private Spinner buildSpinner(Attribute attribute, ViewGroup parent) { ViewGroup row = (ViewGroup) viewContext.getLayoutInflater().inflate(R.layout.input_spinner_view, parent); Spinner spinner = (Spinner) row.findViewById(R.id.spinner); spinner.setPrompt("Select " + attribute.description); ArrayList<AttributeOption> options = new ArrayList<Attribute.AttributeOption>(attribute.options.length + 1); options.addAll(Arrays.asList(attribute.options)); ArrayAdapter<AttributeOption> adapter = new ArrayAdapter<AttributeOption>(viewContext, R.layout.multiline_spinner_item, options); adapter.setDropDownViewResource(R.layout.multiline_spinner_dropdown_item); spinner.setAdapter(adapter);/*from w ww .j a va2 s. c o m*/ return spinner; }
From source file:com.secretparty.app.PartyDetailsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { final int thematicId = getArguments().getInt(ThematicDetailedFragment.THEMATIC_ID, -1); final int partyId = getArguments().getInt(MainActivity.PARTY_ID, -1); if (thematicId == -1 || partyId == -1) { Log.e(TAG, "Error while giving the thematic or Party position"); }//from w w w.j a v a 2s. c om final List<Secret> secrets = mCallback.getThematicRepository().get(thematicId).getSecrets(); View rootView = getActivity().getLayoutInflater().inflate(R.layout.join_party_layout, null); Spinner secret = (Spinner) rootView.findViewById(R.id.S_secrets); ArrayAdapter<Secret> adapter = new ArrayAdapter<Secret>(getActivity(), android.R.layout.simple_spinner_item, secrets); secret.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) { Log.v("PartyDialog", "Item click on " + position); secretChosen = position; } @Override public void onNothingSelected(AdapterView<?> adapterView) { secretChosen = -1; } }); secret.setAdapter(adapter); // Use the Builder class for convenient dialog construction AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(rootView).setTitle(R.string.party_join_dialog) .setPositiveButton(R.string.join, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dismiss(); mCallback.onPartyJoined(partyId, secrets.get(secretChosen).getId()); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Toast.makeText(getActivity(), R.string.party_join_cancel, Toast.LENGTH_LONG).show(); dismiss(); } }); return builder.create(); }
From source file:io.github.tjg1.nori.SearchActivity.java
/** Set up the {@link android.support.v7.app.ActionBar}, including the API service picker dropdown. */ private void setUpActionBar() { Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolBar);/*www. j a va 2 s . co m*/ ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); } // Set up service list spinner. Spinner serviceSpinner = (Spinner) toolBar.findViewById(R.id.spinner_service); ServiceDropdownAdapter serviceDropdownAdapter = new ServiceDropdownAdapter(this, sharedPreferences, getSupportLoaderManager(), serviceSpinner, this); serviceSpinner.setAdapter(serviceDropdownAdapter); serviceSpinner.setOnItemSelectedListener(serviceDropdownAdapter); }
From source file:com.gsma.rcs.provisioning.local.StackProvisioning.java
@Override public void displayRcsSettings() { if (sLogger.isActivated()) { sLogger.debug("displayRcsSettings"); }//from w w w . j av a2s. co m Context ctx = getContext(); Spinner spinner = (Spinner) mRootView.findViewById(R.id.Autoconfig); ArrayAdapter<String> adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, mConfigModes); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); ConfigurationMode mode = sRcsSettings.getConfigurationMode(); spinner.setSelection(ConfigurationMode.AUTO.equals(mode) ? 1 : 0); TextView textView = (TextView) mRootView.findViewById(R.id.client_vendor); textView.setText(Build.MANUFACTURER); spinner = (Spinner) mRootView.findViewById(R.id.EnableRcsSwitch); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, mEnableRcseSwitch); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); EnableRcseSwitch rcsSwitch = sRcsSettings.getEnableRcseSwitch(); switch (rcsSwitch) { case ALWAYS_SHOW: case ONLY_SHOW_IN_ROAMING: spinner.setSelection(rcsSwitch.toInt()); break; default: spinner.setSelection(2); } mHelper.setStringEditText(R.id.SecondaryProvisioningAddress, RcsSettingsData.SECONDARY_PROVISIONING_ADDRESS); mHelper.setBoolCheckBox(R.id.SecondaryProvisioningAddressOnly, RcsSettingsData.SECONDARY_PROVISIONING_ADDRESS_ONLY); spinner = (Spinner) mRootView.findViewById(R.id.NetworkAccess); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, mNetworkAccesses); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); NetworkAccessType access = sRcsSettings.getNetworkAccess(); switch (access) { case MOBILE: spinner.setSelection(1); break; case WIFI: spinner.setSelection(2); break; case ANY: default: spinner.setSelection(0); } spinner = (Spinner) mRootView.findViewById(R.id.SipDefaultProtocolForMobile); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, SIP_PROTOCOL); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); String sipMobile = sRcsSettings.getSipDefaultProtocolForMobile(); if (SIP_PROTOCOL[0].equalsIgnoreCase(sipMobile)) { spinner.setSelection(0); } else if (SIP_PROTOCOL[1].equalsIgnoreCase(sipMobile)) { spinner.setSelection(1); } else { spinner.setSelection(2); } spinner = (Spinner) mRootView.findViewById(R.id.SipDefaultProtocolForWifi); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, SIP_PROTOCOL); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); String sipWifi = sRcsSettings.getSipDefaultProtocolForWifi(); if (SIP_PROTOCOL[0].equalsIgnoreCase(sipWifi)) { spinner.setSelection(0); } else if (SIP_PROTOCOL[1].equalsIgnoreCase(sipWifi)) { spinner.setSelection(1); } else { spinner.setSelection(2); } String[] certificates = loadCertificatesList(); spinner = (Spinner) mRootView.findViewById(R.id.TlsCertificateRoot); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, certificates); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); boolean found = false; String certRoot = sRcsSettings.getTlsCertificateRoot(); for (int i = 0; i < certificates.length; i++) { if (certRoot != null && certRoot.contains(certificates[i])) { spinner.setSelection(i); found = true; } } if (!found) { spinner.setSelection(0); sRcsSettings.writeString(RcsSettingsData.TLS_CERTIFICATE_ROOT, ""); } spinner = (Spinner) mRootView.findViewById(R.id.TlsCertificateIntermediate); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, certificates); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setSelection(0); found = false; String certInt = sRcsSettings.getTlsCertificateIntermediate(); for (int i = 0; i < certificates.length; i++) { if (certInt != null && certInt.contains(certificates[i])) { spinner.setSelection(i); found = true; } } if (!found) { spinner.setSelection(0); sRcsSettings.writeString(RcsSettingsData.TLS_CERTIFICATE_INTERMEDIATE, ""); } spinner = (Spinner) mRootView.findViewById(R.id.FtProtocol); adapter = new ArrayAdapter<>(ctx, android.R.layout.simple_spinner_item, FT_PROTOCOL); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); FileTransferProtocol ftProtocol = sRcsSettings.getFtProtocol(); if (FileTransferProtocol.HTTP.equals(ftProtocol)) { spinner.setSelection(0); } else { spinner.setSelection(1); } mHelper.setLongEditText(R.id.ImsServicePollingPeriod, RcsSettingsData.IMS_SERVICE_POLLING_PERIOD); mHelper.setIntEditText(R.id.SipListeningPort, RcsSettingsData.SIP_DEFAULT_PORT); mHelper.setLongEditText(R.id.SipTimerT1, RcsSettingsData.SIP_TIMER_T1); mHelper.setLongEditText(R.id.SipTimerT2, RcsSettingsData.SIP_TIMER_T2); mHelper.setLongEditText(R.id.SipTimerT4, RcsSettingsData.SIP_TIMER_T4); mHelper.setLongEditText(R.id.SipTransactionTimeout, RcsSettingsData.SIP_TRANSACTION_TIMEOUT); mHelper.setLongEditText(R.id.SipKeepAlivePeriod, RcsSettingsData.SIP_KEEP_ALIVE_PERIOD); mHelper.setIntEditText(R.id.DefaultMsrpPort, RcsSettingsData.MSRP_DEFAULT_PORT); mHelper.setIntEditText(R.id.DefaultRtpPort, RcsSettingsData.RTP_DEFAULT_PORT); mHelper.setLongEditText(R.id.MsrpTransactionTimeout, RcsSettingsData.MSRP_TRANSACTION_TIMEOUT); mHelper.setLongEditText(R.id.RegisterExpirePeriod, RcsSettingsData.REGISTER_EXPIRE_PERIOD); mHelper.setLongEditText(R.id.RegisterRetryBaseTime, RcsSettingsData.REGISTER_RETRY_BASE_TIME); mHelper.setLongEditText(R.id.RegisterRetryMaxTime, RcsSettingsData.REGISTER_RETRY_MAX_TIME); mHelper.setLongEditText(R.id.PublishExpirePeriod, RcsSettingsData.PUBLISH_EXPIRE_PERIOD); mHelper.setLongEditText(R.id.RevokeTimeout, RcsSettingsData.REVOKE_TIMEOUT); mHelper.setLongEditText(R.id.RingingPeriod, RcsSettingsData.RINGING_SESSION_PERIOD); mHelper.setLongEditText(R.id.SubscribeExpirePeriod, RcsSettingsData.SUBSCRIBE_EXPIRE_PERIOD); mHelper.setLongEditText(R.id.IsComposingTimeout, RcsSettingsData.IS_COMPOSING_TIMEOUT); mHelper.setLongEditText(R.id.SessionRefreshExpirePeriod, RcsSettingsData.SESSION_REFRESH_EXPIRE_PERIOD); mHelper.setLongEditText(R.id.CapabilityRefreshTimeout, RcsSettingsData.CAPABILITY_REFRESH_TIMEOUT); mHelper.setLongEditText(R.id.CapabilityExpiryTimeout, RcsSettingsData.CAPABILITY_EXPIRY_TIMEOUT); mHelper.setLongEditText(R.id.CapabilityPollingPeriod, RcsSettingsData.CAPABILITY_POLLING_PERIOD); mHelper.setBoolCheckBox(R.id.TcpFallback, RcsSettingsData.TCP_FALLBACK); mHelper.setBoolCheckBox(R.id.SipKeepAlive, RcsSettingsData.SIP_KEEP_ALIVE); mHelper.setBoolCheckBox(R.id.PermanentState, RcsSettingsData.PERMANENT_STATE_MODE); mHelper.setBoolCheckBox(R.id.TelUriFormat, RcsSettingsData.TEL_URI_FORMAT); mHelper.setBoolCheckBox(R.id.ImAlwaysOn, RcsSettingsData.IM_CAPABILITY_ALWAYS_ON); mHelper.setBoolCheckBox(R.id.FtAlwaysOn, RcsSettingsData.FT_CAPABILITY_ALWAYS_ON); mHelper.setBoolCheckBox(R.id.FtHttpAlwaysOn, RcsSettingsData.FT_HTTP_CAP_ALWAYS_ON); mHelper.setBoolCheckBox(R.id.InviteOnlyGroupchatSF, RcsSettingsData.GROUP_CHAT_INVITE_ONLY_FULL_SF); mHelper.setBoolCheckBox(R.id.ImUseReports, RcsSettingsData.IM_USE_REPORTS); mHelper.setBoolCheckBox(R.id.Gruu, RcsSettingsData.GRUU); mHelper.setBoolCheckBox(R.id.CpuAlwaysOn, RcsSettingsData.CPU_ALWAYS_ON); mHelper.setBoolCheckBox(R.id.SecureMsrpOverWifi, RcsSettingsData.SECURE_MSRP_OVER_WIFI); mHelper.setBoolCheckBox(R.id.SecureRtpOverWifi, RcsSettingsData.SECURE_RTP_OVER_WIFI); mHelper.setBoolCheckBox(R.id.ImeiAsDeviceId, RcsSettingsData.USE_IMEI_AS_DEVICE_ID); mHelper.setBoolCheckBox(R.id.ControlExtensions, RcsSettingsData.CONTROL_EXTENSIONS); mHelper.setBoolCheckBox(R.id.AllowExtensions, RcsSettingsData.ALLOW_EXTENSIONS); mHelper.setIntEditText(R.id.MaxMsrpLengthExtensions, RcsSettingsData.MAX_MSRP_SIZE_EXTENSIONS); mHelper.setLongEditText(R.id.MessagingCapabilitiesValidity, RcsSettingsData.MSG_CAP_VALIDITY_PERIOD); }
From source file:net.majorkernelpanic.spydroid.ClientActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.client);//from www. java2 s .c o m editTextIP = (EditText) findViewById(R.id.server_ip); layoutContainer = (FrameLayout) findViewById(R.id.video_container); layoutForm = (RelativeLayout) findViewById(R.id.form); layoutControl = (RelativeLayout) findViewById(R.id.control); progressBar = (ProgressBar) findViewById(R.id.progress); audioStream = new MediaPlayer(); // Initiate connection with client findViewById(R.id.button_connect).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Editor editor = settings.edit(); editor.putString("last_server_ip", editTextIP.getText().toString()); editor.commit(); layoutForm.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); getCurrentConfiguration(); } }); // Interrupt connection with the client findViewById(R.id.button_stop).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { stopStreaming(); layoutControl.setVisibility(View.GONE); layoutForm.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); } }); // Show configuration panel findViewById(R.id.button_config).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { findViewById(R.id.settings).setVisibility(View.VISIBLE); } }); findViewById(R.id.reconnect).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { findViewById(R.id.settings).setVisibility(View.GONE); updateSettings(); } }); // Resolution Spinner spinner = (Spinner) findViewById(R.id.spinner1); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.videoResolutionArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); // Framerate spinner = (Spinner) findViewById(R.id.spinner2); adapter = ArrayAdapter.createFromResource(this, R.array.videoFramerateArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); // Bitrate spinner = (Spinner) findViewById(R.id.spinner3); adapter = ArrayAdapter.createFromResource(this, R.array.videoBitrateArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); // Video Encoder spinner = (Spinner) findViewById(R.id.spinner4); adapter = ArrayAdapter.createFromResource(this, R.array.videoEncoderArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); // Audio Encoder spinner = (Spinner) findViewById(R.id.spinner5); adapter = ArrayAdapter.createFromResource(this, R.array.audioEncoderArray, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(this); settings = PreferenceManager.getDefaultSharedPreferences(this); editTextIP.setText(settings.getString("last_server_ip", "192.168.0.107")); }