Exemple #1
0
    protected virtual void UpdateView()
    {
        _titleText.text = data.noteText;

        if (data.hasDateTitle)
        {
            _dateTitleText.gameObject.SetActive(true);
            _dateTitleText.text = data.GetDate().ToString("d MMMM, yyyy");
        }
    }
Exemple #2
0
    private void SetState(State state)
    {
        _state = state;

        if (_state == State.Default)
        {
            _selectedNotesData.Clear();
            _selectedNoteData = null;
            _addAndEditScreen.SetActive(false);
            _deleteButton.SetActive(false);
            _addButton.SetActive(true);

            SmallList <EnhancedScrollerCellView> list = _scroller.GetActiveCellViews();
            for (int i = 0; i < list.Count; i++)
            {
                (list[i] as NoteUiItem).SetState(NoteUiItem.State.Normal);
            }
        }
        else if (_state == State.Selection)
        {
            _deleteButton.SetActive(true);
            _addButton.SetActive(false);
            SmallList <EnhancedScrollerCellView> list = _scroller.GetActiveCellViews();
            for (int i = 0; i < list.Count; i++)
            {
                (list[i] as NoteUiItem).SetState(NoteUiItem.State.Selection);
            }
        }
        else if (_state == State.Edit)
        {
            if (_selectedNoteData != null)
            {
                _editScrenTopBarTitle.text = _selectedNoteData.GetDate().ToString("d MMMM, yyyy");
                _noteInput.text            = _selectedNoteData.noteText;
            }
            else
            {
                _editScrenTopBarTitle.text = _targetDate.ToString("d MMMM, yyyy");
                _noteInput.text            = "";
            }

            _addAndEditScreen.SetActive(true);

            // activate input field and show mobile keyboard automatically
            _noteInput.ActivateInputField();
            _noteInput.MoveTextEnd(false);
        }
    }
Exemple #3
0
    private void Awake()
    {
        List <JSONObject> jsonList = TrackerManager.GetJsonList(_localPath);

        for (int i = 0; i < jsonList.Count; i++)
        {
            JSONObject jsonObj = jsonList[i];
            NoteData   data    = new NoteData(jsonObj.ToString());

            // don't manage outdated logs
            if ((DateTime.Today - data.GetDate()).Days > TrackerManager.LOG_LIFE_TIME)
            {
                continue;
            }

            data.OnDataUpdate += DataUpdate;
            _notes.Insert(0, data);
        }
    }