List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.door43.translationstudio.ui.dialogs.BackupDialog.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); v = inflater.inflate(R.layout.dialog_backup, container, false); // get target translation to backup Bundle args = getArguments();/*from w w w.j av a 2 s.co m*/ if (args != null && args.containsKey(ARG_TARGET_TRANSLATION_ID)) { String targetTranslationId = args.getString(ARG_TARGET_TRANSLATION_ID, null); targetTranslation = App.getTranslator().getTargetTranslation(targetTranslationId); if (targetTranslation == null) { throw new InvalidParameterException( "The target translation '" + targetTranslationId + "' is invalid"); } } else { throw new InvalidParameterException("The target translation id was not specified"); } targetTranslation.setDefaultContributor(App.getProfile().getNativeSpeaker()); mBackupToCloudButton = (LinearLayout) v.findViewById(R.id.backup_to_cloud); LinearLayout exportProjectButton = (LinearLayout) v.findViewById(R.id.backup_to_sd); Button backupToAppButton = (Button) v.findViewById(R.id.backup_to_app); Button backupToDeviceButton = (Button) v.findViewById(R.id.backup_to_device); LinearLayout exportToPDFButton = (LinearLayout) v.findViewById(R.id.export_to_pdf); LinearLayout exportToUsfmButton = (LinearLayout) v.findViewById(R.id.export_to_usfm); Button logout = (Button) v.findViewById(R.id.logout_button); logout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { App.setProfile(null); Intent logoutIntent = new Intent(getActivity(), ProfileActivity.class); startActivity(logoutIntent); } }); final String filename = targetTranslation.getId() + "." + Translator.ARCHIVE_EXTENSION; initProgressWatcher(R.string.backup); if (savedInstanceState != null) { // check if returning from device alias dialog settingDeviceAlias = savedInstanceState.getBoolean(STATE_SETTING_DEVICE_ALIAS, false); mDialogShown = eDialogShown .fromInt(savedInstanceState.getInt(STATE_DIALOG_SHOWN, eDialogShown.NONE.getValue())); mAccessFile = savedInstanceState.getString(STATE_ACCESS_FILE, null); mDialogMessage = savedInstanceState.getString(STATE_DIALOG_MESSAGE, null); isOutputToDocumentFile = savedInstanceState.getBoolean(STATE_OUTPUT_TO_DOCUMENT_FILE, false); mDestinationFolderUri = Uri.parse(savedInstanceState.getString(STATE_OUTPUT_FOLDER_URI, "")); restoreDialogs(); } Button dismissButton = (Button) v.findViewById(R.id.dismiss_button); dismissButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); backupToDeviceButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO: 11/18/2015 eventually we need to support bluetooth as well as an adhoc network showDeviceNetworkAliasDialog(); } }); // backup buttons mBackupToCloudButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (App.isNetworkAvailable()) { // make sure we have a gogs user if (App.getProfile().gogsUser == null) { showDoor43LoginDialog(); return; } doPullTargetTranslationTask(targetTranslation, MergeStrategy.RECURSIVE); } else { showNoInternetDialog(); // replaced snack popup which could be hidden behind dialog } } }); exportToPDFButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PrintDialog printDialog = new PrintDialog(); Bundle printArgs = new Bundle(); printArgs.putString(PrintDialog.ARG_TARGET_TRANSLATION_ID, targetTranslation.getId()); printDialog.setArguments(printArgs); showDialogFragment(printDialog, PrintDialog.TAG); } }); exportProjectButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doSelectDestinationFolder(false); } }); exportToUsfmButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { doSelectDestinationFolder(true); } }); if (targetTranslation.isObsProject()) { LinearLayout exportToUsfmSeparator = (LinearLayout) v.findViewById(R.id.export_to_usfm_separator); exportToUsfmSeparator.setVisibility(View.GONE); exportToUsfmButton.setVisibility(View.GONE); } backupToAppButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { File exportFile = new File(App.getSharingDir(), filename); try { App.getTranslator().exportArchive(targetTranslation, exportFile); } catch (Exception e) { Logger.e(TAG, "Failed to export the target translation " + targetTranslation.getId(), e); } if (exportFile.exists()) { Uri u = FileProvider.getUriForFile(getActivity(), "com.door43.translationstudio.fileprovider", exportFile); Intent i = new Intent(Intent.ACTION_SEND); i.setType("application/zip"); i.putExtra(Intent.EXTRA_STREAM, u); startActivity(Intent.createChooser(i, "Email:")); } else { Snackbar snack = Snackbar.make(getActivity().findViewById(android.R.id.content), R.string.translation_export_failed, Snackbar.LENGTH_LONG); ViewUtil.setSnackBarTextColor(snack, getResources().getColor(R.color.light_primary_text)); snack.show(); } } }); // connect to existing tasks PullTargetTranslationTask pullTask = (PullTargetTranslationTask) TaskManager .getTask(PullTargetTranslationTask.TASK_ID); RegisterSSHKeysTask keysTask = (RegisterSSHKeysTask) TaskManager.getTask(RegisterSSHKeysTask.TASK_ID); CreateRepositoryTask repoTask = (CreateRepositoryTask) TaskManager.getTask(CreateRepositoryTask.TASK_ID); PushTargetTranslationTask pushTask = (PushTargetTranslationTask) TaskManager .getTask(PushTargetTranslationTask.TASK_ID); ExportProjectTask projectExportTask = (ExportProjectTask) TaskManager.getTask(ExportProjectTask.TASK_ID); ExportToUsfmTask usfmExportTask = (ExportToUsfmTask) TaskManager.getTask(ExportToUsfmTask.TASK_ID); if (pullTask != null) { taskWatcher.watch(pullTask); } else if (keysTask != null) { taskWatcher.watch(keysTask); } else if (repoTask != null) { taskWatcher.watch(repoTask); } else if (pushTask != null) { taskWatcher.watch(pushTask); } else if (projectExportTask != null) { taskWatcher.watch(projectExportTask); } else if (usfmExportTask != null) { taskWatcher.watch(usfmExportTask); } return v; }
From source file:com.orange.datavenue.StreamListFragment.java
/** * */// www . j av a2s. c o m private void createStream() { final android.app.Dialog dialog = new android.app.Dialog(getActivity()); dialog.setContentView(R.layout.create_stream_dialog); dialog.setTitle(R.string.add_stream); final LinearLayout callbackLayout = (LinearLayout) dialog.findViewById(R.id.callback_layout); final EditText name = (EditText) dialog.findViewById(R.id.name); final EditText description = (EditText) dialog.findViewById(R.id.description); final EditText unit = (EditText) dialog.findViewById(R.id.unit); final EditText symbol = (EditText) dialog.findViewById(R.id.symbol); final EditText callback = (EditText) dialog.findViewById(R.id.callback); final EditText latitude = (EditText) dialog.findViewById(R.id.latitude); final EditText longitude = (EditText) dialog.findViewById(R.id.longitude); Button actionButton = (Button) dialog.findViewById(R.id.add_button); callbackLayout.setVisibility(View.VISIBLE); actionButton.setText(getString(R.string.add_stream)); actionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d(TAG_NAME, "name : " + name.getText().toString()); Log.d(TAG_NAME, "description : " + description.getText().toString()); Log.d(TAG_NAME, "unit : " + unit.getText().toString()); Log.d(TAG_NAME, "symbol : " + symbol.getText().toString()); Stream newStream = new Stream(); newStream.setName(name.getText().toString()); newStream.setDescription(description.getText().toString()); /** * Allocate new Location */ Double[] location = null; String strLatitude = latitude.getText().toString(); String strLongitude = longitude.getText().toString(); try { if ((!"".equals(strLatitude)) && (!"".equals(strLongitude))) { location = new Double[2]; location[0] = Double.parseDouble(strLatitude); location[1] = Double.parseDouble(strLongitude); } } catch (NumberFormatException e) { Log.e(TAG_NAME, e.toString()); location = null; } if (location != null) { newStream.setLocation(location); } /**************************************************************************/ /** * Allocate new Unit & Symbol */ Unit newUnit = null; String strUnit = unit.getText().toString(); String strSymbol = symbol.getText().toString(); if (!"".equals(strUnit)) { if (newUnit == null) { newUnit = new Unit(); } newUnit.setName(strUnit); } if (!"".equals(strSymbol)) { if (newUnit == null) { newUnit = new Unit(); } newUnit.setSymbol(strSymbol); } if (newUnit != null) { newStream.setUnit(newUnit); } /** * Allocate new Callback */ Callback newCallback = null; String callbackUrl = callback.getText().toString(); if (!"".equals(callbackUrl)) { try { URL url = new URL(callbackUrl); newCallback = new Callback(); newCallback.setUrl(url.toString()); newCallback.setName("Callback"); newCallback.setDescription("application callback"); newCallback.setStatus("activated"); } catch (MalformedURLException e) { Log.e(TAG_NAME, e.toString()); callback.setText(""); } } if (newCallback != null) { newStream.setCallback(newCallback); } /**************************************************************************/ CreateStreamOperation createStreamOperation = new CreateStreamOperation(Model.instance.oapiKey, Model.instance.key, Model.instance.currentDatasource, newStream, new OperationCallback() { @Override public void process(Object object, Exception exception) { if (exception == null) { getStreams(); } else { Errors.displayError(getActivity(), exception); } } }); createStreamOperation.execute(""); dialog.dismiss(); } }); Button cancelButton = (Button) dialog.findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.setCancelable(false); dialog.show(); }
From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java
/** * method to hide edit text with animation *///from w ww. j a v a 2s . c o m private void hideEditText(final LinearLayout view) { int cx = view.getRight() - 30; int cy = view.getBottom() - 60; int initialRadius = view.getWidth(); Animator anim = null; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0); } if (anim != null) { anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); } isEditTextVisible = false; if (anim != null) { anim.start(); } }
From source file:fm.krui.kruifm.StreamFragment.java
/** * Manually hides the stream status bar from view. *///from w ww . j a v a 2s. co m public void hideStatusBar() { Log.v(TAG, "Manually hiding status bar."); final LinearLayout statusContainer = (LinearLayout) getActivity() .findViewById(R.id.stream_status_container_linearlayout); final Animation animOut = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_down); animOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // Hide the container from view when it has finished animating statusContainer.setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); statusContainer.startAnimation(animOut); }
From source file:com.mobicage.rogerthat.util.ui.SendMessageView.java
private void resetLayout() { mKey = UUID.randomUUID().toString(); mMessage.setText(""); mMessage.clearFocus();// w w w .j a v a 2 s .c om mButtons = new LinkedHashSet<>(); mSelectedButton = NO_BUTTON_SELECTED; mHasImageSelected = false; mHasVideoSelected = false; mAttachmentContainer.setVisibility(View.GONE); mButtonsContainer.removeAllViews(); final LinearLayout optionButtons = (LinearLayout) findViewById(R.id.imageButtons); optionButtons.setVisibility(View.GONE); mMessage.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { optionButtons.setVisibility(View.VISIBLE); initImageButtonsNavigation(); mMessage.setOnFocusChangeListener(null); } }); }
From source file:com.sentaroh.android.TextFileBrowser.FileViewerFragment.java
@SuppressLint("NewApi") private void buildTextListAdapter() { LinearLayout ll_scroll = (LinearLayout) mMainView.findViewById(R.id.activity_browser_main_scroll_view); if (mViewedFile.lineBreak == CustomTextView.LINE_BREAK_NOTHING && mViewedFile.browseMode == FileViewerAdapter.TEXT_BROWSER_BROWSE_MODE_CHAR) ll_scroll.setVisibility(LinearLayout.VISIBLE); else//from ww w.j a va 2s.c om ll_scroll.setVisibility(LinearLayout.GONE); // mTextListView=(ListView)mMainView.findViewById(R.id.activity_browser_main_view); mTextListAdapter = new FileViewerAdapter(getActivity(), R.layout.text_browser_list_item, mGlblParms.debugEnabled, mIdxReader, mViewedFile.browseMode, mViewedFile.showLineNo, mViewedFile.lineBreak, mGlblParms.settingFontFamily, mGlblParms.settingFontStyle, mGlblParms.settingFontSize, mGlblParms.settingTabStop); // mTextListView.setClickable(true); // mTextListView.setFocusable(true); // mTextListView.setFocusableInTouchMode(true); mTextListView.setAdapter(mTextListAdapter); // mTextListView.setScrollingCacheEnabled(true); mTextListView.setFastScrollEnabled(true); mTextListView.setSelection(0); mTextListView.setSelected(true); final Button btnFind = (Button) mMainView.findViewById(R.id.activity_browser_main_search_btn); final EditText et_find_string = (EditText) mMainView.findViewById(R.id.activity_browser_main_search_text); final CheckBox cb_case = (CheckBox) mMainView .findViewById(R.id.activity_browser_main_search_case_sensitive); btnFind.setVisibility(Button.GONE); et_find_string.setVisibility(EditText.GONE); cb_case.setVisibility(CheckBox.GONE); if (mViewedFile.searchEnabled && mViewedFile.browseMode == FileViewerAdapter.TEXT_BROWSER_BROWSE_MODE_CHAR) { btnFind.setVisibility(Button.VISIBLE); et_find_string.setVisibility(EditText.VISIBLE); cb_case.setVisibility(CheckBox.VISIBLE); } }
From source file:com.sentaroh.android.Utilities.LogUtil.CommonLogFileListDialogFragment.java
private void setContextButtonNormalMode(CommonLogFileListAdapter lfm_adapter) { final TextView dlg_title = (TextView) mDialog.findViewById(R.id.log_file_list_dlg_title); dlg_title.setText(mDialogTitle);/*from ww w . j ava2 s. co m*/ final ImageButton dlg_done = (ImageButton) mDialog.findViewById(R.id.log_file_list_dlg_done); dlg_done.setVisibility(ImageButton.GONE); LinearLayout ll_prof = (LinearLayout) mDialog.findViewById(R.id.log_context_view); LinearLayout ll_delete = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_delete_view); LinearLayout ll_share = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_share_view); LinearLayout ll_select_all = (LinearLayout) ll_prof.findViewById(R.id.log_context_button_select_all_view); LinearLayout ll_unselect_all = (LinearLayout) ll_prof .findViewById(R.id.log_context_button_unselect_all_view); ll_delete.setVisibility(LinearLayout.GONE); ll_share.setVisibility(LinearLayout.GONE); if (lfm_adapter.isEmptyAdapter()) { ll_select_all.setVisibility(LinearLayout.GONE); ll_unselect_all.setVisibility(LinearLayout.GONE); } else { ll_select_all.setVisibility(LinearLayout.VISIBLE); ll_unselect_all.setVisibility(LinearLayout.GONE); } }
From source file:fm.krui.kruifm.StreamActivity.java
/** * Manually hides the stream status bar from view. *///from w ww. j a v a2s. c om public void hideStatusBar() { Log.v(TAG, "Manually hiding status bar."); final LinearLayout statusContainer = (LinearLayout) this .findViewById(R.id.stream_status_container_linearlayout); final Animation animOut = AnimationUtils.loadAnimation(this, R.anim.translate_down); animOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // Hide the container from view when it has finished animating statusContainer.setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); statusContainer.startAnimation(animOut); }
From source file:com.asksven.betterbatterystats.StatsActivity.java
@Override protected void onResume() { super.onResume(); Log.i(TAG, "OnResume called"); if (Analytics.getInstance(this).isEnabled()) { Tracking.startUsage(this); }//w w w . ja v a 2 s . c o m // if debug we check for updates try { PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0); if (pinfo.packageName.endsWith("_xdaedition")) { UpdateManager.register(this); CrashManager.register(this); } } catch (Exception e) { Log.e(TAG, "An error occured registering update/crash manager: " + e.getMessage()); } // Analytics opt-in final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean wasPresentedOptOutAnalytics = prefs.getBoolean("analytics_opt_out_offered", false); if (!wasPresentedOptOutAnalytics) { Log.i(TAG, "Application was launched for the first time with analytics"); Snackbar.make(findViewById(android.R.id.content), R.string.message_first_start, Snackbar.LENGTH_LONG) .show(); Snackbar bar = Snackbar.make(findViewById(android.R.id.content), R.string.pref_app_analytics_summary, Snackbar.LENGTH_LONG).setAction(R.string.label_button_no, new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("analytics", false); editor.commit(); } }); bar.show(); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("analytics_opt_out_offered", true); editor.commit(); } Log.i(TAG, "OnResume called"); Log.i(TAG, "onResume references state: refFrom=" + m_refFromName + " refTo=" + m_refToName); // register the broadcast receiver IntentFilter intentFilter = new IntentFilter(ReferenceStore.REF_UPDATED); m_referenceSavedReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //extract our message from intent String refName = intent.getStringExtra(Reference.EXTRA_REF_NAME); //log our message value if (LogSettings.DEBUG) Log.i(TAG, "Received broadcast, reference was updated:" + refName); // reload the spinners to make sure all refs are in the right sequence when current gets refreshed // if (refName.equals(Reference.CURRENT_REF_FILENAME)) // { refreshSpinners(); // } } }; //registering our receiver this.registerReceiver(m_referenceSavedReceiver, intentFilter); // the service is always started as it handles the widget updates too SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); // show/hide spinners boolean showSpinners = sharedPrefs.getBoolean("show_from_to_ref", true); if (!showSpinners) { LinearLayout spinnerLayout = (LinearLayout) this.findViewById(R.id.LayoutSpinners); if (spinnerLayout != null) { spinnerLayout.setVisibility(View.GONE); } } if (!EventWatcherService.isServiceRunning(this)) { Intent i = new Intent(this, EventWatcherService.class); this.startService(i); } // make sure to create a valid "current" stat if none exists // or if prefs re set to auto refresh boolean bAutoRefresh = sharedPrefs.getBoolean("auto_refresh", true); if ((bAutoRefresh) || (!ReferenceStore.hasReferenceByName(Reference.CURRENT_REF_FILENAME, this))) { Intent serviceIntent = new Intent(this, WriteCurrentReferenceService.class); this.startService(serviceIntent); doRefresh(true); } else { refreshSpinners(); doRefresh(false); } // check if active monitoring is on: if yes make sure the alarm is scheduled if (sharedPrefs.getBoolean("active_mon_enabled", false)) { if (!StatsProvider.isActiveMonAlarmScheduled(this)) { StatsProvider.scheduleActiveMonAlarm(this); } } //Log.i(TAG, "OnResume end"); // we do some stuff here to handle settings about font size String fontSize = sharedPrefs.getString("medium_font_size", "16"); int mediumFontSize = Integer.parseInt(fontSize); //we need to change "since" fontsize TextView tvSince = (TextView) findViewById(R.id.TextViewSince); tvSince.setTextSize(TypedValue.COMPLEX_UNIT_SP, mediumFontSize); }
From source file:com.example.accountkitsample.MainActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (AccountKit.getCurrentAccessToken() != null) { showHelloActivity(null);//from w w w .j a v a 2s .co m } final Spinner themeSpinner = (Spinner) findViewById(R.id.theme_spinner); if (themeSpinner != null) { final ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.theme_options, android.R.layout.simple_spinner_dropdown_item); themeSpinner.setAdapter(adapter); themeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { switch (position) { case 0: selectedThemeId = R.style.AppLoginTheme; break; case 1: selectedThemeId = R.style.AppLoginTheme_Salmon; break; case 2: selectedThemeId = R.style.AppLoginTheme_Yellow; break; case 3: selectedThemeId = R.style.AppLoginTheme_Red; break; case 4: selectedThemeId = R.style.AppLoginTheme_Dog; break; case 5: selectedThemeId = R.style.AppLoginTheme_Bicycle; break; case 6: selectedThemeId = R.style.AppLoginTheme_Reverb_A; advancedUISwitch.setChecked(true); break; case 7: selectedThemeId = R.style.AppLoginTheme_Reverb_B; advancedUISwitch.setChecked(true); break; case 8: selectedThemeId = R.style.AppLoginTheme_Reverb_C; advancedUISwitch.setChecked(true); break; default: selectedThemeId = -1; break; } } @Override public void onNothingSelected(final AdapterView<?> parent) { selectedThemeId = -1; } }); } advancedUISwitch = (Switch) findViewById(R.id.advanced_ui_switch); final MainActivity thisActivity = this; final LinearLayout advancedUIOptionsLayout = (LinearLayout) findViewById(R.id.advanced_ui_options); final List<CharSequence> buttonNames = new ArrayList<>(); buttonNames.add("Default"); for (ButtonType buttonType : ButtonType.values()) { buttonNames.add(buttonType.name()); } final ArrayAdapter<CharSequence> buttonNameAdapter = new ArrayAdapter<>(thisActivity, android.R.layout.simple_spinner_dropdown_item, buttonNames); advancedUISwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { advancedUIOptionsLayout.setVisibility(View.VISIBLE); final Spinner entryButtonSpinner = (Spinner) findViewById(R.id.entry_button_spinner); if (entryButtonSpinner != null) { entryButtonSpinner.setAdapter(buttonNameAdapter); entryButtonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { // First position is empty, so anything past that if (position > 0) { entryButton = ButtonType .valueOf(entryButtonSpinner.getSelectedItem().toString()); } else { entryButton = null; } } @Override public void onNothingSelected(final AdapterView<?> parent) { entryButton = null; } }); } final Spinner confirmButtonSpinner = (Spinner) findViewById(R.id.confirm_button_spinner); if (confirmButtonSpinner != null) { confirmButtonSpinner.setAdapter(buttonNameAdapter); confirmButtonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { // First position is empty, so anything past // that if (position > 0) { confirmButton = ButtonType .valueOf(confirmButtonSpinner.getSelectedItem().toString()); } else { confirmButton = null; } } @Override public void onNothingSelected(final AdapterView<?> parent) { confirmButton = null; } }); } final Spinner textPositionSpinner = (Spinner) findViewById(R.id.text_position_spinner); if (textPositionSpinner != null) { final List<CharSequence> textPositions = new ArrayList<>(); textPositions.add("Default"); for (TextPosition textPosition : TextPosition.values()) { textPositions.add(textPosition.name()); } final ArrayAdapter<CharSequence> textPositionAdapter = new ArrayAdapter<>(thisActivity, android.R.layout.simple_spinner_dropdown_item, textPositions); textPositionSpinner.setAdapter(textPositionAdapter); textPositionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { // First position is empty, so anything past // that if (position > 0) { textPosition = TextPosition .valueOf(textPositionSpinner.getSelectedItem().toString()); } else { textPosition = null; } } @Override public void onNothingSelected(final AdapterView<?> parent) { textPosition = null; } }); } } else if (isReverbThemeSelected()) { advancedUISwitch.setChecked(true); Toast.makeText(MainActivity.this, R.string.reverb_advanced_ui_required, Toast.LENGTH_LONG) .show(); } else { advancedUIOptionsLayout.setVisibility(View.GONE); } } }); }