Пример #1
0
  /** Diplaying fragment view for selected nav drawer list item */
  @SuppressLint("NewApi")
  protected void displayView(int type, int catId) {
    if (isNotif) {
      isNotif = false;
      return;
    }
    if (isSettings) {
      isSettings = false;
      getFragmentManager().popBackStack();
    }
    String title = CategoryItem.getCatName(this, type, catId);
    Fragment fragment = null;
    FragmentManager fragmentManager = getSupportFragmentManager();
    switch (type) {
      case ADD_TASK:
        CategoryListFragment list = new CategoryListFragment();
        list.show(fragmentManager, CategoryListFragment.class.getSimpleName());
        return;

      default:
        fragment = new TaskListFragment(type, catId, title);
        fragmentManager
            .beginTransaction()
            .replace(R.id.frame_container, fragment, TaskListFragment.class.getSimpleName())
            .commit();

        break;
    }

    selectNavPosition(type, catId, title);
    changeToolbarColor(type, catId);
  }
Пример #2
0
  @SuppressLint("NewApi")
  protected void changeToolbarColor(int type, int catID) {

    //		switch (type) {
    //		case TasksTable.TASK_TYPE_COMMING_UP:
    //			catID = 0;
    //			break;
    //		case TasksTable.TASK_TYPE_NEXT_SEVEN_DAYS:
    //			catID = 1;
    //			break;
    //		case TasksTable.TASK_TYPE_ALL_TASKS:
    //			catID = 2;
    //			break;
    //		default:
    //			break;
    //		}
    String clr = CategoryItem.getDbColod(this, catID);
    if (clr == null) return;
    int color = Color.parseColor(clr);
    toolbar.setBackgroundColor(color);
    changeStatusBarColor(color);
  }