Esempio n. 1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);

    saveBoton = (Button) findViewById(R.id.button1);
    cancelBoton = (Button) findViewById(R.id.button2);

    et = (EditText) findViewById(R.id.editText1);

    prefs = getSharedPreferences("preferences", Context.MODE_PRIVATE);

    et.setText(String.valueOf(prefs.getLong("rad", 100)));

    spin = (Spinner) findViewById(R.id.spinner1);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(this, R.array.units, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spin.setAdapter(adapter);
    spin.setOnItemSelectedListener(new MyOnItemSelectedListener());

    saveBoton.setOnClickListener(new OnClickSaveListener());

    cancelBoton.setOnClickListener(new OnClickCancelListener());
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.blackmagicactivity_layout);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(getString(R.string.hack_login));

    username = (EditText) findViewById(R.id.username);
    password = (EditText) findViewById(R.id.password);
    spinner = (Spinner) findViewById(R.id.spinner);

    SpinnerAdapter mSpinnerAdapter =
        ArrayAdapter.createFromResource(
            this, R.array.tail, android.R.layout.simple_spinner_dropdown_item);

    spinner.setAdapter(mSpinnerAdapter);
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String[] array = getResources().getStringArray(R.array.tail_value);
            String value = array[position];
            appkey = value.substring(0, value.indexOf(","));
            appSecret = value.substring(value.indexOf(",") + 1);
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });
  }
Esempio n. 3
0
  private void setUpSpinnerAdapters() {
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.currencies, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    currency1Spinner.setAdapter(adapter);
    currency2Spinner.setAdapter(adapter);
    currency2Spinner.setSelection(1);
  }
  protected void initVideoSpinners() {
    ArrayAdapter<CharSequence> adapter;

    // Video parameters spinners
    frameSizeSpinner = (Spinner) findViewById(R.id.frameSize_spinner);
    adapter =
        ArrayAdapter.createFromResource(
            this, R.array.frame_size_values, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    frameSizeSpinner.setAdapter(adapter);
    frameSizeSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            String[] frameSizeContainer =
                frameSizeSpinner.getSelectedItem().toString().split("x", 2);
            videoWidthOut = Integer.valueOf(frameSizeContainer[0].trim());
            videoHeightOut = Integer.valueOf(frameSizeContainer[1].trim());
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });

    videoBitRateSpinner = (Spinner) findViewById(R.id.videoBitRate_spinner);
    adapter =
        ArrayAdapter.createFromResource(
            this, R.array.video_bit_rate_values, android.R.layout.simple_spinner_item);
    videoBitRateSpinner.setAdapter(adapter);
    videoBitRateSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            videoBitRateInKBytes =
                Integer.valueOf(videoBitRateSpinner.getSelectedItem().toString());
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapterView) {}
        });
  }
  private void setupSpinner(Spinner spinner, int optionResourceId, int defaultSelection) {
    Context context = getContext();
    if (context != null) {
      ArrayAdapter<CharSequence> adapter =
          ArrayAdapter.createFromResource(
              context, optionResourceId, android.R.layout.simple_spinner_item);

      adapter.setDropDownViewResource(R.layout.spinner_centered_wrapped);
      spinner.setGravity(Gravity.CENTER);
      spinner.setAdapter(adapter);
      spinner.setSelection(defaultSelection);
    }
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.masstab);

    spinnerFrom = (Spinner) findViewById(R.id.SpinnerFrom);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.weights, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerFrom.setAdapter(adapter);

    spinnerTo = (Spinner) findViewById(R.id.SpinnerTo);
    spinnerTo.setAdapter(adapter);

    final Button button = (Button) findViewById(R.id.Go_Button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            calculate();
          }
        });
  }
Esempio n. 7
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceBundle) {
    Bundle args = getArguments();

    // If position == 0 then Owe, if == 1 then Owed
    position = args.getInt("pos");

    View v;
    v = inflater.inflate(R.layout.iou_info_edit_frag, container, false);

    // Find Views by id
    confirm = (Button) v.findViewById(R.id.iou_editconfirm);
    cancel = (Button) v.findViewById(R.id.iou_deletecancel);
    close = (ImageButton) v.findViewById(R.id.owe_done_button);
    date = (TextView) v.findViewById(R.id.owe_info_date);
    name = (TextView) v.findViewById(R.id.owe_dialog_name);
    amount = (TextView) v.findViewById(R.id.owe_dialog_amount);
    desc = (TextView) v.findViewById(R.id.owe_description);
    spinner = (Spinner) v.findViewById(R.id.add_subt_spinner);
    editBox = (LinearLayout) v.findViewById(R.id.edit_layout);

    // Set up Spinner Values
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            getActivity(), R.array.add_subt_array, R.layout.spinner_item);
    adapter.setDropDownViewResource(R.layout.spinner_dropdown);

    spinner.setAdapter(adapter);

    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0) {
              add = true;
            } else {
              add = false;
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {
            // To change body of implemented methods use File | Settings | File Templates.
          }
        });

    // Set the TextViews
    name.setText(args.getString("name"));
    amount.setText(String.valueOf(args.getDouble("amount")));
    if (args.getString("desc").length() != 0) {
      desc.setText(args.getString("desc"));
    } else {
      desc.setText("None");
    }
    date.setText(args.getString("date"));

    confirm.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            editBox.setVisibility(View.VISIBLE);
          }
        });

    return v;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_edit_automation);

    mUri = null;
    mDescriptionShoppingList = "?";

    mSpinnerAction = (Spinner) findViewById(R.id.spinner_action);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.automation_actions, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSpinnerAction.setAdapter(adapter);

    mSpinnerAction.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mDescriptionAction =
                getResources().getStringArray(R.array.automation_actions)[position];

            updateTextViews();
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });

    mButtonCountdown = (Button) findViewById(R.id.button_list);
    mButtonCountdown.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            pickList();
          }
        });

    mButtonOk = (Button) findViewById(R.id.button_ok);
    mButtonOk.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            doOk();
          }
        });

    mButtonOk.setEnabled(false);

    Button b = (Button) findViewById(R.id.button_cancel);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            doCancel();
          }
        });

    mTextCommand = (TextView) findViewById(R.id.command);
    // mTextSelectAction = (TextView) findViewById(R.id.select_action);
    // mTextSelectCountdown = (TextView)
    // findViewById(R.id.select_countdown);

    if (savedInstanceState != null) {
      if (savedInstanceState.containsKey(BUNDLE_ACTION)) {
        int i = savedInstanceState.getInt(BUNDLE_ACTION);
        mSpinnerAction.setSelection(i);
      }
      if (savedInstanceState.containsKey(BUNDLE_LIST_URI)) {
        mUri = Uri.parse(savedInstanceState.getString(BUNDLE_LIST_URI));
        setListNameFromUri();
      }
    } else {
      final Intent intent = getIntent();

      if (intent != null) {
        String action = intent.getStringExtra(ShoppingListIntents.EXTRA_ACTION);

        if (ShoppingListIntents.TASK_CLEAN_UP_LIST.equals(action)) {
          mSpinnerAction.setSelection(0);
        } else {
          // set default
          mSpinnerAction.setSelection(0);
        }

        // Get list:

        final String dataString = intent.getStringExtra(ShoppingListIntents.EXTRA_DATA);
        if (dataString != null) {
          mUri = Uri.parse(dataString);
        }
        setListNameFromUri();
      }
    }

    updateTextViews();
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.zip_picker);

    LoggerManager.setLoggerFactory(new AndroidLoggerFactory());

    logger = (AndroidLogger) LoggerManager.getLogger(this.getClass().getName());
    // enable toasts for info level logging.  toasts are default for error and warnings.
    logger.setToastContext(getBaseContext());
    logger.setInfoToastEnabled(true);

    Button createButton = (Button) findViewById(R.id.SignButton);
    createButton.setOnClickListener(
        new OnClickListener() {
          public void onClick(View view) {
            invokeZipSignerActivity();
          }
        });

    String extStorageDir = Environment.getExternalStorageDirectory().toString();
    // Strip /mnt from /sdcard
    if (extStorageDir.startsWith("/mnt/sdcard")) extStorageDir = extStorageDir.substring(4);

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    String inputFile = prefs.getString(PREFERENCE_IN_FILE, extStorageDir + "/unsigned.zip");
    String outputFile = prefs.getString(PREFERENCE_OUT_FILE, extStorageDir + "/signed.zip");
    int keyIndex = prefs.getInt(PREFERENCE_KEY_INDEX, 0);

    EditText inputText = (EditText) findViewById(R.id.InFileEditText);
    inputText.setText(inputFile);

    EditText outputText = (EditText) findViewById(R.id.OutFileEditText);
    outputText.setText(outputFile);

    Button button = (Button) findViewById(R.id.OpenPickButton);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            pickInputFile();
          }
        });

    button = (Button) findViewById(R.id.SaveAsPickButton);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            pickOutputFile();
          }
        });

    button = (Button) findViewById(R.id.InOutPickButton);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View arg0) {
            pickInputOutputFiles();
          }
        });

    Spinner spinner = (Spinner) findViewById(R.id.KeyModeSpinner);
    keyModeSpinnerAdapter =
        KeyListSpinnerAdapter.createInstance(this, android.R.layout.simple_spinner_item);
    keyModeSpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(keyModeSpinnerAdapter);
    if (keyIndex >= keyModeSpinnerAdapter.getCount()) keyIndex = 0;
    spinner.setSelection(keyIndex);
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
            SharedPreferences.Editor editor = prefs.edit();
            editor.putInt(PREFERENCE_KEY_INDEX, position);
            editor.commit();
            updateAlgorithmSpinner(position);
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapter) {}
        });

    algorithmSpinner = (Spinner) findViewById(R.id.CertSignatureAlgorithm);
    sha1WithRsaSpinnerAdapter =
        ArrayAdapter.createFromResource(
            this, R.array.Sha1WithRsaAlgorithmArray, android.R.layout.simple_spinner_item);
    sha1WithRsaSpinnerAdapter.setDropDownViewResource(
        android.R.layout.simple_spinner_dropdown_item);
    allAlgorithmsSpinnerAdapter =
        ArrayAdapter.createFromResource(
            this, R.array.AllShaWithRsaAlgorithmsArray, android.R.layout.simple_spinner_item);
    allAlgorithmsSpinnerAdapter.setDropDownViewResource(
        android.R.layout.simple_spinner_dropdown_item);

    updateAlgorithmSpinner(keyIndex);

    algorithmSpinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
            if (algorithmSpinnerAdapter.getCount() > 1) {
              SharedPreferences.Editor editor = prefs.edit();
              editor.putInt(PREFERENCE_ALG_INDEX, position);
              editor.commit();
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> adapter) {}
        });
  }