Esempio n. 1
0
  private void handleListCreating(String name, boolean isList) {

    name = Utils.getUniqueListName(lists, name);

    String type = isList ? "lista" : "notatka";

    ((IndexFragment) mainFragment)
        .getProvider()
        .addItem(name, (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date()), type);
    listName = name;
    listId = 1;

    lists.add(name);

    Fragment fragment =
        isList
            ? PrivateListFragment.newInstance(name, listId)
            : NoteFragment.newInstance(name, listId);

    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.replace(R.id.container, fragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    fragmentTransaction.commit();

    setTitle(name);
    Log.v("start", "start");
  }
Esempio n. 2
0
  @Override
  public void itemClicked(String name, String date, String type, int id) {

    listName = name;
    listId = id;

    if (date.equals("")) {
      Toast.makeText(this, "Jeszcze nie gotowe", Toast.LENGTH_SHORT).show();
    } else { // TODO wspolna lista
      setTitle(name);

      Fragment fragment = new Fragment();
      if (type.equals("notatka")) {
        fragment = NoteFragment.newInstance(name, id);
      } else if (type.equals("lista")) {
        fragment = PrivateListFragment.newInstance(name, id);
      }
      FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
      fragmentTransaction.replace(R.id.container, fragment);
      fragmentTransaction.addToBackStack(null);
      fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
      fragmentTransaction.commit();
    }
  }