Esempio n. 1
0
#pragma warning restore 0649

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.lyt_post_description);
            Cheeseknife.Inject(this);

            _pageTitle.Typeface   = Style.Semibold;
            _title.Typeface       = Style.Regular;
            _description.Typeface = Style.Regular;
            _postButton.Typeface  = Style.Semibold;
            _postButton.Click    += OnPost;
            _photoFrame.Clickable = true;
            _photoFrame.Click    += PhotoFrameOnClick;
            _postButton.Text      = Localization.Texts.PublishButtonText;
            _postButton.Enabled   = true;

            _localTagsList.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false));
            _localTagsAdapter        = new SelectedTagsAdapter();
            _localTagsAdapter.Click += LocalTagsAdapterClick;
            _localTagsList.SetAdapter(_localTagsAdapter);
            _localTagsList.AddItemDecoration(new ListItemDecoration((int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 15, Resources.DisplayMetrics)));

            _tagsList.SetLayoutManager(new LinearLayoutManager(this));
            Presenter.SourceChanged += PresenterSourceChanged;
            _tagsAdapter             = new TagsAdapter(Presenter);
            _tagsAdapter.Click      += OnTagsAdapterClick;
            _tagsList.SetAdapter(_tagsAdapter);

            _tag.TextChanged       += OnTagOnTextChanged;
            _tag.KeyboardDownEvent += HideTagsList;
            _tag.OkKeyEvent        += HideTagsList;
            _tag.FocusChange       += OnTagOnFocusChange;

            _topMarginTagsLayout.Click += OnTagsLayoutClick;
            _backButton.Click          += OnBack;
            _rootLayout.Click          += OnRootLayoutClick;

            _timer = new Timer(OnTimer);

            InitPhoto();
            SetPostingTimer();
            SearchTextChanged();

            _model = new PreparePostModel(BasePresenter.User.UserInfo);
        }
#pragma warning restore 0649

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.lyt_post_description);
            Cheeseknife.Bind(this);

            _tag.Hint         = AppSettings.LocalizationManager.GetText(LocalizationKeys.AddHashtag);
            _title.Hint       = AppSettings.LocalizationManager.GetText(LocalizationKeys.EnterPostTitle);
            _description.Hint = AppSettings.LocalizationManager.GetText(LocalizationKeys.EnterPostDescription);
            _postButton.Text  = AppSettings.LocalizationManager.GetText(LocalizationKeys.PublishButtonText);
            _pageTitle.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.PostSettings);

            _pageTitle.Typeface   = Style.Semibold;
            _title.Typeface       = Style.Regular;
            _description.Typeface = Style.Regular;
            _postButton.Typeface  = Style.Semibold;
            _postButton.Click    += OnPost;
            _photoFrame.Clickable = true;
            _rotate.Click        += RotateOnClick;

            _postButton.Enabled = true;

            _localTagsList.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false));
            _localTagsAdapter        = new SelectedTagsAdapter();
            _localTagsAdapter.Click += LocalTagsAdapterClick;
            _localTagsList.SetAdapter(_localTagsAdapter);
            _localTagsList.AddItemDecoration(new ListItemDecoration((int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 15, Resources.DisplayMetrics)));

            var editPost = Intent.GetStringExtra(EditPost);

            if (!string.IsNullOrEmpty(editPost))
            {
                _editpost = JsonConvert.DeserializeObject <Post>(editPost);
                _model    = new PreparePostModel(BasePresenter.User.UserInfo, _editpost.Permlink);
                SetEditPost(_editpost);
                _rotate.Visibility = ViewStates.Gone;
            }
            else
            {
                _model = new PreparePostModel(BasePresenter.User.UserInfo);
                InitPhoto();
                SetPostingTimer();
            }

            _tagsList.SetLayoutManager(new LinearLayoutManager(this));
            Presenter.SourceChanged += PresenterSourceChanged;
            _tagsAdapter             = new TagsAdapter(Presenter);
            _tagsAdapter.Click      += OnTagsAdapterClick;
            _tagsList.SetAdapter(_tagsAdapter);

            _tag.TextChanged       += OnTagOnTextChanged;
            _tag.KeyboardDownEvent += HideTagsList;
            _tag.OkKeyEvent        += HideTagsList;
            _tag.FocusChange       += OnTagOnFocusChange;

            _topMarginTagsLayout.Click += OnTagsLayoutClick;
            _backButton.Click          += OnBack;
            _rootLayout.Click          += OnRootLayoutClick;

            _timer = new Timer(OnTimer);

            SearchTextChanged();
        }