List of usage examples for android.widget Spinner setEnabled
@Override public void setEnabled(boolean enabled)
From source file:com.mariogrip.octodroid.mainActivity.java
private void Fill() { switch (pos) { case 0:/*from w w w . j a v a 2s .c o m*/ try { util.logD("Running runner"); TextView oflline = (TextView) findViewById(R.id.textView_offline); if (memory.isServerUp()) { oflline.setText(""); try { if (util_get.isConnected()) { final Spinner spinner = (Spinner) findViewById(R.id.spinner); spinner.setEnabled(false); final Spinner spinner2 = (Spinner) findViewById(R.id.spinner2); spinner2.setEnabled(false); final Button right = (Button) findViewById(R.id.buttonConDis); right.setText("Disconnect"); right.setEnabled(true); } else { final Spinner spinner = (Spinner) findViewById(R.id.spinner); spinner.setEnabled(true); final Spinner spinner2 = (Spinner) findViewById(R.id.spinner2); spinner2.setEnabled(true); final Button right = (Button) findViewById(R.id.buttonConDis); right.setText("Connect"); right.setEnabled(true); } } catch (Exception e) { } ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar); TextView texttime = (TextView) findViewById(R.id.textView11_time); TextView textpri = (TextView) findViewById(R.id.textView16_printed); TextView textest = (TextView) findViewById(R.id.textView13_est); TextView textfile = (TextView) findViewById(R.id.textView11_file); TextView textmaci = (TextView) findViewById(R.id.textView10_maci); TextView texttarT = (TextView) findViewById(R.id.textView18_tar_t); TextView textcurT = (TextView) findViewById(R.id.textView18_cur_T); TextView textBcur = (TextView) findViewById(R.id.textView18_Bcur_T); TextView textBtar = (TextView) findViewById(R.id.textView18_Btar_T); TextView textprinttime = (TextView) findViewById(R.id.textView17_print_time); // TextView texthei = (TextView) findViewById(R.id.textView15_hei); //TextView textfila = (TextView) findViewById(R.id.textView12_fila); //TextView texttimel = (TextView) findViewById(R.id.textView14_timel); textfile.setText(" " + memory.job.file.name); textpri.setText(" " + util.toMBGB(memory.job.progress.filepos).toString() + "/" + util.toMBGB(memory.job.file.size).toString()); texttime.setText(" " + util.toHumanRead(memory.job.progress.PrintTimeLeft)); textest.setText(" " + util.toHumanRead(memory.job.estimatedPrintTime)); textmaci.setText(" " + memory.connection.current.state); texttarT.setText(" " + memory.temp.target.Ext[0] + "C"); textcurT.setText(" " + memory.temp.current.Ext[0] + "C"); textBcur.setText(" " + memory.temp.current.Bed[0] + "C"); textBtar.setText(" " + memory.temp.target.Bed[0] + "C"); textprinttime.setText(" " + util.toHumanRead(memory.job.progress.printTime)); progress.setProgress(util.getProgress()); // textfila.setText(" " + memory.Filament); // texttimel.setText(" " + memory.Timelapse); // texthei.setText(" " + memory.Height); } else { TextView textmaci = (TextView) findViewById(R.id.textView10_maci); textmaci.setText("Cannot connect to\n" + ip); oflline.setText("Offline"); } } catch (Exception v) { v.printStackTrace(); } break; case 2: TextView oflline = (TextView) findViewById(R.id.textView_offline); if (memory.isServerUp()) { try { oflline.setText(""); ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar); TextView texttime = (TextView) findViewById(R.id.textView11_time); texttime.setText(" " + util.toHumanRead(memory.job.progress.PrintTimeLeft)); progress.setProgress(util.getProgress()); } catch (Exception v) { } } else { oflline.setText("Offline"); } break; case 1: TextView oflline2 = (TextView) findViewById(R.id.textView_offline); if (memory.isServerUp()) { try { oflline2.setText(""); ProgressBar progresss = (ProgressBar) findViewById(R.id.progressBar); TextView texttimes = (TextView) findViewById(R.id.textView11_time); texttimes.setText(" " + util.toHumanRead(memory.job.progress.getPrintTimeLeft())); progresss.setProgress(util.getProgress()); TextView textbed = (TextView) findViewById(R.id.textView_CurentTemp_bed_Tempcard); TextView textext = (TextView) findViewById(R.id.textView_CurentTemp_ext_TempCard); textbed.setText(memory.temp.current.getBed()[0] + "C"); textext.setText(memory.temp.current.getExt()[0] + "C"); } catch (Exception v) { } } else { oflline2.setText("Offline"); } break; default: break; } }
From source file:systems.soapbox.ombuds.client.ui.WalletActivity.java
private void prepareRestoreWalletDialog(final Dialog dialog) { final AlertDialog alertDialog = (AlertDialog) dialog; final List<File> files = new LinkedList<File>(); // external storage if (Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.exists() && Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.isDirectory()) for (final File file : Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.listFiles()) if (Crypto.OPENSSL_FILE_FILTER.accept(file)) files.add(file);//w w w . ja v a 2s .co m // internal storage for (final String filename : fileList()) if (filename.startsWith(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF + '.')) files.add(new File(getFilesDir(), filename)); // sort Collections.sort(files, new Comparator<File>() { @Override public int compare(final File lhs, final File rhs) { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }); final View replaceWarningView = alertDialog .findViewById(R.id.restore_wallet_from_storage_dialog_replace_warning); final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0; replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE); final Spinner fileView = (Spinner) alertDialog.findViewById(R.id.import_keys_from_storage_file); final FileAdapter adapter = (FileAdapter) fileView.getAdapter(); adapter.setFiles(files); fileView.setEnabled(!adapter.isEmpty()); final EditText passwordView = (EditText) alertDialog.findViewById(R.id.import_keys_from_storage_password); passwordView.setText(null); final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener( passwordView, alertDialog) { @Override protected boolean hasFile() { return fileView.getSelectedItem() != null; } @Override protected boolean needsPassword() { final File selectedFile = (File) fileView.getSelectedItem(); return selectedFile != null ? Crypto.OPENSSL_FILE_FILTER.accept(selectedFile) : false; } }; passwordView.addTextChangedListener(dialogButtonEnabler); fileView.setOnItemSelectedListener(dialogButtonEnabler); final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_storage_show); showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView)); }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTaskProfile.java
final static private void setEditTaskActionListener(final GlobalParameters mGlblParms, final Dialog dialog, final AdapterProfileList pfla, ListView pflv, final String curr_grp, final ArrayList<TaskActionEditListItem> adapter_act_list) { final Spinner spinnerActionProfile = (Spinner) dialog.findViewById(R.id.edit_profile_task_user_actionlist); CustomSpinnerAdapter adapterActionProfile = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterActionProfile.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerActionProfile(mGlblParms, dialog, pfla, pflv, spinnerActionProfile, adapterActionProfile);//from w ww .j ava2s.c o m if (adapterActionProfile.getCount() == 0) spinnerActionProfile.setEnabled(false); final Spinner spinnerBuiltinPrimitiveAction = (Spinner) dialog .findViewById(R.id.edit_profile_task_builtin_primitive_actionlist); CustomSpinnerAdapter adapterBuiltinPrimitiveAction = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterBuiltinPrimitiveAction.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerBuiltinPrimitiveAction(mGlblParms, dialog, spinnerBuiltinPrimitiveAction, adapterBuiltinPrimitiveAction); if (adapterBuiltinPrimitiveAction.getCount() == 0) spinnerBuiltinPrimitiveAction.setEnabled(false); final Spinner spinnerBuiltinConditionalAction = (Spinner) dialog .findViewById(R.id.edit_profile_task_builtin_conditional_actionlist); CustomSpinnerAdapter adapterBuiltinConditionalAction = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterBuiltinConditionalAction.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerBuiltinConditionalAction(mGlblParms, dialog, spinnerBuiltinConditionalAction, adapterBuiltinConditionalAction); if (adapterBuiltinConditionalAction.getCount() == 0) spinnerBuiltinConditionalAction.setEnabled(false); final Spinner spinnerBuiltinCancelAction = (Spinner) dialog .findViewById(R.id.edit_profile_task_builtin_cancel_actionlist); CustomSpinnerAdapter adapterBuiltinCancelAction = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterBuiltinCancelAction.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerBuiltinCancelAction(mGlblParms, dialog, spinnerBuiltinCancelAction, adapterBuiltinCancelAction); if (adapterBuiltinCancelAction.getCount() == 0) spinnerBuiltinCancelAction.setEnabled(false); final Spinner spinnerBuiltinBlockAction = (Spinner) dialog .findViewById(R.id.edit_profile_task_builtin_block_actionlist); CustomSpinnerAdapter adapterBuiltinBlockAction = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterBuiltinBlockAction.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerBuiltinBlockAction(mGlblParms, dialog, spinnerBuiltinBlockAction, adapterBuiltinBlockAction); if (adapterBuiltinBlockAction.getCount() == 0) spinnerBuiltinBlockAction.setEnabled(false); final ListView lv_act_list = (ListView) dialog.findViewById(android.R.id.list); mGlblParms.taskActionListAdapter = new AdapterTaskActionEditList(mGlblParms.context, R.layout.task_action_list_item, adapter_act_list); lv_act_list.setAdapter(mGlblParms.taskActionListAdapter); lv_act_list.setEnabled(true); lv_act_list.setSelected(true); lv_act_list.setOnItemClickListener(new OnItemClickListener() { @Override final public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { if (!mGlblParms.taskActionListAdapter.getItem(position).action.startsWith(BUILTIN_PREFIX) && !curr_grp.equals(QUICK_TASK_GROUP_NAME)) { for (int i = 0; i < pfla.getDataListCount(); i++) { if (pfla.getDataListItem(i).getProfileType().equals(PROFILE_TYPE_ACTION) && pfla.getDataListItem(i).getProfileGroup().equals(curr_grp) && pfla.getDataListItem(i).getProfileName() .equals(mGlblParms.taskActionListAdapter.getItem(position).action)) { NotifyEvent ntfy = new NotifyEvent(mGlblParms.context); ntfy.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { updateTaskActionEditListDescription(mGlblParms, dialog, pfla, curr_grp, adapter_act_list); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); } @Override public void negativeResponse(Context c, Object[] o) { } }); ProfileMaintenanceActionProfile pmap = ProfileMaintenanceActionProfile.newInstance(); pmap.showDialog(mGlblParms.frgamentMgr, pmap, "EDIT", curr_grp, pfla.getDataListItem(i)); pmap.setNotifyEvent(ntfy); break; } } } } }); lv_act_list.setOnItemLongClickListener(new OnItemLongClickListener() { @Override final public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { createTaskActionListContextMenu(mGlblParms, dialog, curr_grp, arg2, pfla); return false; } }); // Add user action? spinnerActionProfile.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (arg2 != 0) { TaskActionEditListItem taeli = new TaskActionEditListItem(); taeli.action = (String) spinnerActionProfile.getSelectedItem(); mGlblParms.taskActionListAdapter.add(taeli); updateTaskActionEditListDescription(mGlblParms, dialog, pfla, curr_grp, adapter_act_list); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); lv_act_list.setSelection(mGlblParms.taskActionListAdapter.getCount() - 1); arg0.setSelection(0); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); // Add builtin action primitive? spinnerBuiltinPrimitiveAction.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (arg2 != 0) { TaskActionEditListItem taeli = new TaskActionEditListItem(); taeli.action = (String) spinnerBuiltinPrimitiveAction.getSelectedItem(); mGlblParms.taskActionListAdapter.add(taeli); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); lv_act_list.setSelection(mGlblParms.taskActionListAdapter.getCount() - 1); arg0.setSelection(0); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); // Add builtin action conditional? spinnerBuiltinConditionalAction.setOnItemSelectedListener(new OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (arg2 != 0) { TaskActionEditListItem taeli = new TaskActionEditListItem(); taeli.action = (String) spinnerBuiltinConditionalAction.getSelectedItem(); mGlblParms.taskActionListAdapter.add(taeli); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); lv_act_list.setSelection(mGlblParms.taskActionListAdapter.getCount() - 1); arg0.setSelection(0); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); // Add builtin action cancel? spinnerBuiltinCancelAction.setOnItemSelectedListener(new OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (arg2 != 0) { TaskActionEditListItem taeli = new TaskActionEditListItem(); taeli.action = (String) spinnerBuiltinCancelAction.getSelectedItem(); mGlblParms.taskActionListAdapter.add(taeli); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); lv_act_list.setSelection(mGlblParms.taskActionListAdapter.getCount() - 1); arg0.setSelection(0); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); // Add builtin action block? spinnerBuiltinBlockAction.setOnItemSelectedListener(new OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if (arg2 != 0) { TaskActionEditListItem taeli = new TaskActionEditListItem(); taeli.action = (String) spinnerBuiltinBlockAction.getSelectedItem(); mGlblParms.taskActionListAdapter.add(taeli); mGlblParms.taskActionListAdapter.notifyDataSetChanged(); lv_act_list.setSelection(mGlblParms.taskActionListAdapter.getCount() - 1); arg0.setSelection(0); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); final Spinner spinnerSelectAction = (Spinner) dialog.findViewById(R.id.edit_profile_task_select_action); CustomSpinnerAdapter adapterSelectAction = new CustomSpinnerAdapter(mGlblParms.context, R.layout.custom_simple_spinner_item); adapterSelectAction.setTextColor(Color.BLACK); ProfileMaintenance.setSpinnerSelectAction(mGlblParms, dialog, spinnerSelectAction, adapterSelectAction); spinnerSelectAction.setOnItemSelectedListener(new OnItemSelectedListener() { @Override final public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { spinnerActionProfile.setVisibility(Spinner.GONE); spinnerBuiltinPrimitiveAction.setVisibility(Spinner.GONE); spinnerBuiltinConditionalAction.setVisibility(Spinner.GONE); spinnerBuiltinCancelAction.setVisibility(Spinner.GONE); spinnerBuiltinBlockAction.setVisibility(Spinner.GONE); String act = (String) spinnerSelectAction.getSelectedItem(); if (act.equals(mGlblParms.context.getString(R.string.msgs_edit_profile_action_select_user))) { spinnerActionProfile.setVisibility(Spinner.VISIBLE); } else if (act .equals(mGlblParms.context.getString(R.string.msgs_edit_profile_action_select_primitive))) { spinnerBuiltinPrimitiveAction.setVisibility(Spinner.VISIBLE); } else if (act.equals( mGlblParms.context.getString(R.string.msgs_edit_profile_action_select_conditional))) { spinnerBuiltinConditionalAction.setVisibility(Spinner.VISIBLE); } else if (act .equals(mGlblParms.context.getString(R.string.msgs_edit_profile_action_select_cancel))) { spinnerBuiltinCancelAction.setVisibility(Spinner.VISIBLE); } else if (act .equals(mGlblParms.context.getString(R.string.msgs_edit_profile_action_select_block))) { spinnerBuiltinBlockAction.setVisibility(Spinner.VISIBLE); } } @Override final public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.app.blockydemo.content.bricks.SetVariableBrick.java
@Override public View getView(final Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; }//from www .java2 s.co m if (view == null) { alphaValue = 255; } view = View.inflate(context, R.layout.brick_set_variable, null); view = getViewWithAlpha(alphaValue); setCheckboxView(R.id.brick_set_variable_checkbox); final Brick brickInstance = this; checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checked = isChecked; adapter.handleCheck(brickInstance, isChecked); } }); TextView prototypeText = (TextView) view.findViewById(R.id.brick_set_variable_prototype_view); TextView textField = (TextView) view.findViewById(R.id.brick_set_variable_edit_text); prototypeText.setVisibility(View.GONE); variableFormula.setTextFieldId(R.id.brick_set_variable_edit_text); variableFormula.refreshTextField(view); textField.setVisibility(View.VISIBLE); textField.setOnClickListener(this); Spinner variableSpinner = (Spinner) view.findViewById(R.id.set_variable_spinner); UserVariableAdapter userVariableAdapter = ProjectManager.getInstance().getCurrentProject() .getUserVariables().createUserVariableAdapter(context, sprite); UserVariableAdapterWrapper userVariableAdapterWrapper = new UserVariableAdapterWrapper(context, userVariableAdapter); userVariableAdapterWrapper.setItemLayout(android.R.layout.simple_spinner_item, android.R.id.text1); variableSpinner.setAdapter(userVariableAdapterWrapper); if (!(checkbox.getVisibility() == View.VISIBLE)) { variableSpinner.setClickable(true); variableSpinner.setEnabled(true); } else { variableSpinner.setClickable(false); variableSpinner.setFocusable(false); } setSpinnerSelection(variableSpinner, null); variableSpinner.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (((Spinner) view).getSelectedItemPosition() == 0 && ((Spinner) view).getAdapter().getCount() == 1) { NewVariableDialog dialog = new NewVariableDialog((Spinner) view); dialog.addVariableDialogListener(SetVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); return true; } } return false; } }); variableSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0 && ((UserVariableAdapterWrapper) parent.getAdapter()).isTouchInDropDownView()) { NewVariableDialog dialog = new NewVariableDialog((Spinner) parent); dialog.addVariableDialogListener(SetVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); } ((UserVariableAdapterWrapper) parent.getAdapter()).resetIsTouchInDropDownView(); userVariable = (UserVariable) parent.getItemAtPosition(position); adapterView = parent; } @Override public void onNothingSelected(AdapterView<?> arg0) { userVariable = null; } }); return view; }
From source file:com.app.blockydemo.content.bricks.ChangeVariableBrick.java
@Override public View getView(final Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; }/* w w w.ja va2s . c o m*/ view = View.inflate(context, R.layout.brick_change_variable_by, null); view = getViewWithAlpha(alphaValue); setCheckboxView(R.id.brick_change_variable_checkbox); final Brick brickInstance = this; checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { checked = isChecked; adapter.handleCheck(brickInstance, isChecked); } }); TextView prototypeText = (TextView) view.findViewById(R.id.brick_change_variable_prototype_view); TextView textField = (TextView) view.findViewById(R.id.brick_change_variable_edit_text); prototypeText.setVisibility(View.GONE); variableFormula.setTextFieldId(R.id.brick_change_variable_edit_text); variableFormula.refreshTextField(view); textField.setVisibility(View.VISIBLE); textField.setOnClickListener(this); Spinner variableSpinner = (Spinner) view.findViewById(R.id.change_variable_spinner); UserVariableAdapter userVariableAdapter = ProjectManager.getInstance().getCurrentProject() .getUserVariables().createUserVariableAdapter(context, sprite); UserVariableAdapterWrapper userVariableAdapterWrapper = new UserVariableAdapterWrapper(context, userVariableAdapter); userVariableAdapterWrapper.setItemLayout(android.R.layout.simple_spinner_item, android.R.id.text1); variableSpinner.setAdapter(userVariableAdapterWrapper); if (!(checkbox.getVisibility() == View.VISIBLE)) { variableSpinner.setClickable(true); variableSpinner.setEnabled(true); } else { variableSpinner.setClickable(false); variableSpinner.setFocusable(false); } setSpinnerSelection(variableSpinner, null); variableSpinner.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (((Spinner) view).getSelectedItemPosition() == 0 && ((Spinner) view).getAdapter().getCount() == 1) { NewVariableDialog dialog = new NewVariableDialog((Spinner) view); dialog.addVariableDialogListener(ChangeVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); return true; } } return false; } }); variableSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0 && ((UserVariableAdapterWrapper) parent.getAdapter()).isTouchInDropDownView()) { NewVariableDialog dialog = new NewVariableDialog((Spinner) parent); dialog.addVariableDialogListener(ChangeVariableBrick.this); dialog.show(((FragmentActivity) view.getContext()).getSupportFragmentManager(), NewVariableDialog.DIALOG_FRAGMENT_TAG); } ((UserVariableAdapterWrapper) parent.getAdapter()).resetIsTouchInDropDownView(); userVariable = (UserVariable) parent.getItemAtPosition(position); adapterView = parent; } @Override public void onNothingSelected(AdapterView<?> arg0) { userVariable = null; } }); return view; }
From source file:com.jefftharris.passwdsafe.sync.MainActivity.java
/** Update the UI when the Google Drive account is changed */ private void updateGdriveAccount(Cursor cursor) { boolean haveCursor = (cursor != null); GuiUtils.setVisible(findViewById(R.id.gdrive_container), haveCursor); GuiUtils.setVisible(findViewById(R.id.gdrive_separator), haveCursor); if (haveCursor) { long id = cursor.getLong(PasswdSafeContract.Providers.PROJECTION_IDX_ID); String acct = PasswdSafeContract.Providers.getDisplayName(cursor); int freqVal = cursor.getInt(PasswdSafeContract.Providers.PROJECTION_IDX_SYNC_FREQ); ProviderSyncFreqPref freq = ProviderSyncFreqPref.freqValueOf(freqVal); itsGDrivePlayUri = ContentUris.withAppendedId(PasswdSafeContract.Providers.CONTENT_URI, id); TextView acctView = (TextView) findViewById(R.id.gdrive_acct); assert acctView != null; acctView.setText(acct);// w ww . j av a2s .c o m View freqSpinLabel = findViewById(R.id.gdrive_interval_label); assert freqSpinLabel != null; Spinner freqSpin = (Spinner) findViewById(R.id.gdrive_interval); assert freqSpin != null; freqSpin.setSelection(freq.getDisplayIdx()); freqSpin.setEnabled(true); freqSpinLabel.setEnabled(true); } else { itsGDrivePlayUri = null; } }
From source file:com.jefftharris.passwdsafe.sync.MainActivity.java
/** Update the UI when the Box account is changed */ private void updateBoxAccount(Cursor cursor) { boolean haveCursor = (cursor != null); GuiUtils.setVisible(findViewById(R.id.box_container), haveCursor); GuiUtils.setVisible(findViewById(R.id.box_separator), haveCursor); if (haveCursor) { long id = cursor.getLong(PasswdSafeContract.Providers.PROJECTION_IDX_ID); String acct = PasswdSafeContract.Providers.getDisplayName(cursor); int freqVal = cursor.getInt(PasswdSafeContract.Providers.PROJECTION_IDX_SYNC_FREQ); ProviderSyncFreqPref freq = ProviderSyncFreqPref.freqValueOf(freqVal); itsBoxUri = ContentUris.withAppendedId(PasswdSafeContract.Providers.CONTENT_URI, id); boolean authorized = getBoxProvider().isAccountAuthorized(); TextView acctView = (TextView) findViewById(R.id.box_acct); assert acctView != null; acctView.setText(acct);/* w ww.ja va2s. c o m*/ View freqSpinLabel = findViewById(R.id.box_interval_label); assert freqSpinLabel != null; Spinner freqSpin = (Spinner) findViewById(R.id.box_interval); assert freqSpin != null; freqSpin.setSelection(freq.getDisplayIdx()); freqSpin.setEnabled(true); freqSpinLabel.setEnabled(true); GuiUtils.setVisible(findViewById(R.id.box_acct_unlink), !authorized); } else { itsBoxUri = null; } }
From source file:com.jefftharris.passwdsafe.sync.MainActivity.java
/** Update the UI when the Dropbox account is changed */ private void updateDropboxAccount(Cursor cursor) { boolean haveCursor = (cursor != null); GuiUtils.setVisible(findViewById(R.id.dropbox_container), haveCursor); GuiUtils.setVisible(findViewById(R.id.dropbox_separator), haveCursor); if (haveCursor) { long id = cursor.getLong(PasswdSafeContract.Providers.PROJECTION_IDX_ID); String acct = PasswdSafeContract.Providers.getDisplayName(cursor); int freqVal = cursor.getInt(PasswdSafeContract.Providers.PROJECTION_IDX_SYNC_FREQ); ProviderSyncFreqPref freq = ProviderSyncFreqPref.freqValueOf(freqVal); itsDropboxUri = ContentUris.withAppendedId(PasswdSafeContract.Providers.CONTENT_URI, id); boolean authorized = getDbxProvider().isAccountAuthorized(); TextView acctView = (TextView) findViewById(R.id.dropbox_acct); assert acctView != null; acctView.setText(acct);// www . ja va2s . com View chooseFilesBtn = findViewById(R.id.dropbox_choose_files); assert chooseFilesBtn != null; chooseFilesBtn.setEnabled(authorized); View freqSpinLabel = findViewById(R.id.dropbox_interval_label); assert freqSpinLabel != null; Spinner freqSpin = (Spinner) findViewById(R.id.dropbox_interval); assert freqSpin != null; freqSpin.setSelection(freq.getDisplayIdx()); freqSpin.setEnabled(true); freqSpinLabel.setEnabled(true); GuiUtils.setVisible(findViewById(R.id.dropbox_acct_unlink), !authorized); } else { itsDropboxUri = null; } }
From source file:com.jefftharris.passwdsafe.sync.MainActivity.java
/** Update the UI when the OneDrive account is changed */ private void updateOnedriveAccount(Cursor cursor) { boolean haveCursor = (cursor != null); GuiUtils.setVisible(findViewById(R.id.onedrive_container), haveCursor); GuiUtils.setVisible(findViewById(R.id.onedrive_separator), haveCursor); if (haveCursor) { long id = cursor.getLong(PasswdSafeContract.Providers.PROJECTION_IDX_ID); String acct = PasswdSafeContract.Providers.getDisplayName(cursor); int freqVal = cursor.getInt(PasswdSafeContract.Providers.PROJECTION_IDX_SYNC_FREQ); ProviderSyncFreqPref freq = ProviderSyncFreqPref.freqValueOf(freqVal); itsOnedriveUri = ContentUris.withAppendedId(PasswdSafeContract.Providers.CONTENT_URI, id); Provider provider = getOnedriveProvider(); boolean authorized = provider.isAccountAuthorized(); TextView acctView = (TextView) findViewById(R.id.onedrive_acct); assert acctView != null; acctView.setText(acct);//from w w w.ja v a 2 s . c om GuiUtils.setVisible(findViewById(R.id.onedrive_auth_required), !authorized); View freqSpinLabel = findViewById(R.id.onedrive_interval_label); assert freqSpinLabel != null; Spinner freqSpin = (Spinner) findViewById(R.id.onedrive_interval); assert freqSpin != null; freqSpin.setSelection(freq.getDisplayIdx()); freqSpin.setEnabled(true); freqSpinLabel.setEnabled(true); } else { itsOnedriveUri = null; } }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java
private void prepareRestoreWalletDialog(final Dialog dialog) { final AlertDialog alertDialog = (AlertDialog) dialog; final List<File> files = new LinkedList<File>(); // external storage if (Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.exists() && Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.isDirectory()) for (final File file : Constants.Files.EXTERNAL_WALLET_BACKUP_DIR.listFiles()) { if (!file.getName().contains("evergreencoin")) continue; if (WalletUtils.BACKUP_FILE_FILTER.accept(file) || WalletUtils.KEYS_FILE_FILTER.accept(file) || Crypto.OPENSSL_FILE_FILTER.accept(file)) files.add(file);//from w w w . j a va 2 s. c o m } // internal storage for (final String filename : fileList()) if (filename.startsWith(Constants.Files.WALLET_KEY_BACKUP_PROTOBUF + '.')) files.add(new File(getFilesDir(), filename)); // sort Collections.sort(files, new Comparator<File>() { @Override public int compare(final File lhs, final File rhs) { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }); final View replaceWarningView = alertDialog .findViewById(R.id.restore_wallet_from_storage_dialog_replace_warning); final boolean hasCoins = application.getWallet().getBalance(BalanceType.ESTIMATED).signum() > 0; replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE); final Spinner fileView = (Spinner) alertDialog.findViewById(R.id.import_keys_from_storage_file); final FileAdapter adapter = (FileAdapter) fileView.getAdapter(); adapter.setFiles(files); fileView.setEnabled(!adapter.isEmpty()); final EditText passwordView = (EditText) alertDialog.findViewById(R.id.import_keys_from_storage_password); passwordView.setText(null); final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener( passwordView, alertDialog) { @Override protected boolean hasFile() { return fileView.getSelectedItem() != null; } @Override protected boolean needsPassword() { final File selectedFile = (File) fileView.getSelectedItem(); return selectedFile != null ? Crypto.OPENSSL_FILE_FILTER.accept(selectedFile) : false; } }; passwordView.addTextChangedListener(dialogButtonEnabler); fileView.setOnItemSelectedListener(dialogButtonEnabler); final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_storage_show); showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView)); }