Ejemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.page_napredna_pretraga);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    myPrefs = PreferenceManager.getDefaultSharedPreferences(this);

    inicComponent();
    onComponentClick();
    fillData();

    Helper.inicActionBar(
        NaprednaPretragaPage.this,
        ComponentInstance.getTitleString(ComponentInstance.STRING_POSLOVNI_ADRESAR));

    ComponentInstance.inicGoogleBaner(
        this, myPrefs.getString("nazivGrada", ""), "ca-app-pub-1530516813542398/1143993865");
  }
Ejemplo n.º 2
0
  private void fillData() {
    // TODO Auto-generated method stub
    txtTitle.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_POSLOVNI_ADRESAR));

    txtDelatnost.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_DELATNOST));
    txtImeFirme.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_IME_FIRME));
    txtAdresa.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_ADRESA));
    txtZona.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_ZONA));
    txtGrad.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_GRAD));
    txtKategorija.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_KATEGORIJA));

    searchButton.setText(ComponentInstance.getTitleString(ComponentInstance.STRING_TRAZI));

    ArrayAdapter<DataItem> gradAdapter =
        new ArrayAdapter<DataItem>(
            this,
            android.R.layout.simple_spinner_item,
            DataContainer.getInstance()
                .getDrzaveItems()
                .get(
                    DataContainer.getInstance()
                        .getDrzaveItems()
                        .indexOf(new DataItem(myPrefs.getString("drzavaId", "0"))))
                .getListDataItem());
    gradAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerGrad.setAdapter(gradAdapter);

    spinnerGrad.setSelection(0);

    spinnerGrad.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(
              AdapterView<?> adapterView, View view, int position, long arg3) {
            // TODO Auto-generated method stub
            ArrayAdapter<DataItem> zonaAdapter =
                new ArrayAdapter<DataItem>(
                    view.getContext(),
                    android.R.layout.simple_spinner_item,
                    DataContainer.getInstance()
                        .getDrzaveItems()
                        .get(
                            DataContainer.getInstance()
                                .getDrzaveItems()
                                .indexOf(new DataItem(myPrefs.getString("drzavaId", "0"))))
                        .getListDataItem()
                        .get(position)
                        .getListDataItem());
            zonaAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinnerZona.setAdapter(zonaAdapter);
            spinnerZona.setSelection(0);
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

          }
        });

    ArrayAdapter<DataItem> kategorijaAdapter =
        new ArrayAdapter<DataItem>(
            this,
            android.R.layout.simple_spinner_item,
            DataContainer.getInstance().getKategorijaSearchItems());
    kategorijaAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerKategorija.setAdapter(kategorijaAdapter);

    spinnerKategorija.setSelection(0);

    spinnerKategorija.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {

          @Override
          public void onItemSelected(
              AdapterView<?> adapterView, View view, int position, long arg3) {
            // TODO Auto-generated method stub
            ArrayAdapter<DataItem> delatnostAdapter =
                new ArrayAdapter<DataItem>(
                    view.getContext(),
                    android.R.layout.simple_spinner_item,
                    DataContainer.getInstance()
                        .getKategorijaSearchItems()
                        .get(position)
                        .getListDataItem());
            delatnostAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinnerDelatnost.setAdapter(delatnostAdapter);
            spinnerDelatnost.setSelection(0);
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

          }
        });
  }