Slide psa / quiz toast from the top.
This commit is contained in:
		
							parent
							
								
									dd78052f92
								
							
						
					
					
						commit
						ff25f1d5c9
					
				
					 4 changed files with 24 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -140,16 +140,16 @@ void HistoryInner::BotAbout::clickHandlerPressedChanged(
 | 
			
		|||
 | 
			
		||||
HistoryInner::HistoryInner(
 | 
			
		||||
	not_null<HistoryWidget*> historyWidget,
 | 
			
		||||
	not_null<Ui::ScrollArea*> scroll,
 | 
			
		||||
	not_null<Window::SessionController*> controller,
 | 
			
		||||
	Ui::ScrollArea *scroll,
 | 
			
		||||
	not_null<History*> history)
 | 
			
		||||
: RpWidget(nullptr)
 | 
			
		||||
, _widget(historyWidget)
 | 
			
		||||
, _scroll(scroll)
 | 
			
		||||
, _controller(controller)
 | 
			
		||||
, _peer(history->peer)
 | 
			
		||||
, _history(history)
 | 
			
		||||
, _migrated(history->migrateFrom())
 | 
			
		||||
, _widget(historyWidget)
 | 
			
		||||
, _scroll(scroll)
 | 
			
		||||
, _scrollDateCheck([this] { scrollDateCheck(); })
 | 
			
		||||
, _scrollDateHideTimer([this] { scrollDateHideByTimer(); }) {
 | 
			
		||||
	Instance = this;
 | 
			
		||||
| 
						 | 
				
			
			@ -2489,12 +2489,16 @@ void HistoryInner::elementShowPollResults(
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void HistoryInner::elementShowTooltip(const TextWithEntities &text) {
 | 
			
		||||
	Ui::Toast::Show(_widget, Ui::Toast::Config{
 | 
			
		||||
	if (const auto strong = _topToast.get()) {
 | 
			
		||||
		strong->hideAnimated();
 | 
			
		||||
	}
 | 
			
		||||
	_topToast = Ui::Toast::Show(_scroll, Ui::Toast::Config{
 | 
			
		||||
		.text = text,
 | 
			
		||||
		.st = &st::historyInfoToast,
 | 
			
		||||
		.durationMs = CountToastDuration(text),
 | 
			
		||||
		.multiline = true,
 | 
			
		||||
		.dark = true,
 | 
			
		||||
		.slideSide = RectPart::Top,
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,6 +34,9 @@ class SessionController;
 | 
			
		|||
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class PopupMenu;
 | 
			
		||||
namespace Toast {
 | 
			
		||||
class Instance;
 | 
			
		||||
} // namespace Toast
 | 
			
		||||
} // namespace Ui
 | 
			
		||||
 | 
			
		||||
class HistoryWidget;
 | 
			
		||||
| 
						 | 
				
			
			@ -49,8 +52,8 @@ public:
 | 
			
		|||
 | 
			
		||||
	HistoryInner(
 | 
			
		||||
		not_null<HistoryWidget*> historyWidget,
 | 
			
		||||
		not_null<Ui::ScrollArea*> scroll,
 | 
			
		||||
		not_null<Window::SessionController*> controller,
 | 
			
		||||
		Ui::ScrollArea *scroll,
 | 
			
		||||
		not_null<History*> history);
 | 
			
		||||
 | 
			
		||||
	Main::Session &session() const;
 | 
			
		||||
| 
						 | 
				
			
			@ -312,14 +315,20 @@ private:
 | 
			
		|||
 | 
			
		||||
	static HistoryInner *Instance;
 | 
			
		||||
 | 
			
		||||
	not_null<Window::SessionController*> _controller;
 | 
			
		||||
 | 
			
		||||
	const not_null<HistoryWidget*> _widget;
 | 
			
		||||
	const not_null<Ui::ScrollArea*> _scroll;
 | 
			
		||||
	const not_null<Window::SessionController*> _controller;
 | 
			
		||||
	const not_null<PeerData*> _peer;
 | 
			
		||||
	const not_null<History*> _history;
 | 
			
		||||
 | 
			
		||||
	History *_migrated = nullptr;
 | 
			
		||||
	int _contentWidth = 0;
 | 
			
		||||
	int _historyPaddingTop = 0;
 | 
			
		||||
 | 
			
		||||
	// Save visible area coords for painting / pressing userpics.
 | 
			
		||||
	int _visibleAreaTop = 0;
 | 
			
		||||
	int _visibleAreaBottom = 0;
 | 
			
		||||
 | 
			
		||||
	// With migrated history we perhaps do not need to display
 | 
			
		||||
	// the first _history message date (just skip it by height).
 | 
			
		||||
	int _historySkipHeight = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -327,8 +336,6 @@ private:
 | 
			
		|||
	std::unique_ptr<BotAbout> _botAbout;
 | 
			
		||||
	std::unique_ptr<HistoryView::EmptyPainter> _emptyPainter;
 | 
			
		||||
 | 
			
		||||
	HistoryWidget *_widget = nullptr;
 | 
			
		||||
	Ui::ScrollArea *_scroll = nullptr;
 | 
			
		||||
	mutable History *_curHistory = nullptr;
 | 
			
		||||
	mutable int _curBlock = 0;
 | 
			
		||||
	mutable int _curItem = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -375,10 +382,7 @@ private:
 | 
			
		|||
	QTimer _touchScrollTimer;
 | 
			
		||||
 | 
			
		||||
	base::unique_qptr<Ui::PopupMenu> _menu;
 | 
			
		||||
 | 
			
		||||
	// save visible area coords for painting / pressing userpics
 | 
			
		||||
	int _visibleAreaTop = 0;
 | 
			
		||||
	int _visibleAreaBottom = 0;
 | 
			
		||||
	base::weak_ptr<Ui::Toast::Instance> _topToast;
 | 
			
		||||
 | 
			
		||||
	bool _scrollDateShown = false;
 | 
			
		||||
	Ui::Animations::Simple _scrollDateOpacity;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1842,7 +1842,8 @@ void HistoryWidget::showHistory(
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		_scroll->hide();
 | 
			
		||||
		_list = _scroll->setOwnedWidget(object_ptr<HistoryInner>(this, controller(), _scroll, _history));
 | 
			
		||||
		_list = _scroll->setOwnedWidget(
 | 
			
		||||
			object_ptr<HistoryInner>(this, _scroll, controller(), _history));
 | 
			
		||||
		_list->show();
 | 
			
		||||
 | 
			
		||||
		_updateHistoryItems.stop();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
Subproject commit 48a83157407c555d3a0c17026aced41308138d49
 | 
			
		||||
Subproject commit 7849f0561b7d8d0e51e3fec3dcfe07e1502c82cc
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue