Example #1
0
  public void updateui() {

    ((EditText) findViewById(R.id.add_task_name)).setText(taskname);

    String hr = "" + hour;
    String mn = "" + minute;

    if (hour < 10) {
      hr = "0" + hour;
    }
    if (minute < 10) {
      mn = "0" + minute;
    }

    ((Button) findViewById(R.id.add_alarm_time)).setText(hr + ":" + mn);
    List<String> items = new ArrayList<String>();

    items.add("Sunday");
    items.add("Monday");
    items.add("Tuesday");
    items.add("Wednesday");
    items.add("Thursday");
    items.add("Friday");
    items.add("Saturday");

    MultiSpinner multiSpinner = (MultiSpinner) findViewById(R.id.add_days);
    Log.i("fdsadsf", "updating ui");
    multiSpinner.setItems(items, "Repeat:", this);
    selectedItems = multiSpinner.getSelected();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (!Utils.isTablet(getActivity())) setHasOptionsMenu(true);

    this.inflate = inflater;
    v = inflater.inflate(R.layout.udobra_list, null);
    listView = (ExpandableListView) v.findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    if (Utils.LOCALE.equals("ru")) {
      AssetsHelper assetsHelper = new AssetsHelper(getActivity());
      db = assetsHelper.getReadableDatabase();
    } else {
      DBHelper dbHelper = new DBHelper(getActivity());
      db = dbHelper.getReadableDatabase();
    }
    searchView = (android.support.v7.widget.SearchView) v.findViewById(R.id.searchV);
    searchView.setIconifiedByDefault(false);
    searchView.setOnQueryTextListener(this);
    searchView.setSubmitButtonEnabled(false);
    searchView.setQueryHint(getResources().getString(R.string.Search));

    MultiSpinner multiSpinner = (MultiSpinner) v.findViewById(R.id.filterSpinner);
    Map<Integer, String> filter = new HashMap<Integer, String>();
    filter.put(1, getResources().getString(R.string.Favorites));
    filter.put(2, getResources().getString(R.string.Added));
    multiSpinner.setItems(getResources().getString(R.string.Filter), this, filter, 1);
    fillData(0);
    listView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) {
              listView.collapseGroup(lastExpandedPosition);
            }
            lastExpandedPosition = groupPosition;
          }
        });
    return v;
  }