Commit aef68d02 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

ui/ux: remove dynamic positioning of loading spinner and splash

- fixes loading spinner and image postioning
- adds loading status text block

Change-Id: Ica5d523ffb332891edcd402f5f7e351e961a1db5
Tuleap: #790
parent 60022a5d
......@@ -51,18 +51,38 @@
Width="auto"
Height="auto">
</Rectangle>
<Canvas Canvas.ZIndex="6">
<TextBlock x:Name="_loadingStatus_"
Foreground="Red"
Canvas.ZIndex="7"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="[LOADING STATE]">
<TextBlock.RenderTransform>
<TranslateTransform X="0" Y="100"/>
</TextBlock.RenderTransform>
</TextBlock>
<Canvas Canvas.ZIndex="6"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Image x:Name="_loadingImage_"
Source="Assets/SplashScreen.scale-200.png"
Width="620"
Height="300"/>
Height="300">
<Image.RenderTransform>
<TranslateTransform X="-310" Y="-150"/>
</Image.RenderTransform>
</Image>
<ProgressRing x:Name="_splashProgressRing_"
Foreground="#19a0b7"
IsActive="True"
MaxWidth="200"
MaxHeight="200"
Width="118"
Height="118"/>
Width="136"
Height="136">
<ProgressRing.RenderTransform>
<TranslateTransform X="-166" Y="-68"/>
</ProgressRing.RenderTransform>
</ProgressRing>
</Canvas>
</Grid>
<SplitView x:Name="_outerSplitView_"
......
......@@ -95,6 +95,13 @@ MainPage::MainPage()
RingD::instance->registrationStateErrorGeneric += ref new RingClientUWP::RegistrationStateErrorGeneric(this, &RingClientUWP::MainPage::OnregistrationStateErrorGeneric);
RingD::instance->registrationStateRegistered += ref new RingClientUWP::RegistrationStateRegistered(this, &RingClientUWP::MainPage::OnregistrationStateRegistered);
RingD::instance->callPlaced += ref new RingClientUWP::CallPlaced(this, &RingClientUWP::MainPage::OncallPlaced);
RingD::instance->setLoadingStatusText += ref new SetLoadingStatusText([this](String^ statusText, String^ color){
_loadingStatus_->Text = statusText;
auto col = Utils::ColorFromString(color);
auto brush = ref new Windows::UI::Xaml::Media::SolidColorBrush(col);
_loadingStatus_->Foreground = brush;
});
}
void
......@@ -158,17 +165,6 @@ RingClientUWP::MainPage::showLoadingOverlay(bool load, bool modal)
_loadingOverlayRect_->Fill = whiteBrush;
_loadingOverlayRect_->Opacity = 1.0;
}
TimeSpan delay;
delay.Duration = 10000 * 50;
ThreadPoolTimer^ delayTimer = ThreadPoolTimer::CreateTimer(
ref new TimerElapsedHandler([this](ThreadPoolTimer^ source)
{
Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([this]()
{
OnResize(nullptr, nullptr);
}));
}), delay);
}
else if (!load && isLoading) {
isLoading = false;
......@@ -176,44 +172,9 @@ RingClientUWP::MainPage::showLoadingOverlay(bool load, bool modal)
}
}
void
RingClientUWP::MainPage::PositionImage()
{
bounds = ApplicationView::GetForCurrentView()->VisibleBounds;
auto img = ref new Image();
auto bitmapImage = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage();
Windows::Foundation::Uri^ uri;
_loadingImage_->SetValue(Canvas::LeftProperty, bounds.Width * 0.5 - _loadingImage_->Width * 0.5);
_loadingImage_->SetValue(Canvas::TopProperty, bounds.Height * 0.5 - _loadingImage_->Height * 0.5);
}
void
RingClientUWP::MainPage::PositionRing()
{
double left;
double top;
_splashProgressRing_->Width = 144;
_splashProgressRing_->Height = 144;
left = bounds.Width * 0.5 - _loadingImage_->Width * 0.5 + 139;
top = bounds.Height * 0.5 - _loadingImage_->Height * 0.5 + 78;
_splashProgressRing_->SetValue(Canvas::LeftProperty, left);
_splashProgressRing_->SetValue(Canvas::TopProperty, top);
}
void
RingClientUWP::MainPage::OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e)
{
Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([this]()
{
PositionImage();
PositionRing();
}));
}
void
......
......@@ -44,8 +44,6 @@ protected:
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
virtual void OnKeyDown(KeyRoutedEventArgs^ e) override;
void PositionImage();
void PositionRing();
void OnResize(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e);
private:
......
......@@ -452,7 +452,7 @@ RingD::registerCallbacks()
if (state3 == CallStatus::OUTGOING_RINGING ||
state3 == CallStatus::INCOMING_RINGING) {
try {
Configuration::UserPreferences::instance->sendVCard(callId);
//Configuration::UserPreferences::instance->sendVCard(callId);
}
catch (Exception^ e) {
EXC_(e);
......@@ -539,6 +539,13 @@ RingD::registerCallbacks()
dynamic_cast<RingClientUWP::MainPage^>(frame->Content)->showLoadingOverlay(false, false);
editModeOn_ = false;
}*/
setLoadingStatusText("Registration successful", "#ff00ff00");
}));
}
else if (state == DRing::Account::States::TRYING) {
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
setLoadingStatusText("Attempting to register account...", "#ff00f0f0");
}));
}
else if (state == DRing::Account::States::ERROR_GENERIC
......@@ -555,6 +562,7 @@ RingD::registerCallbacks()
ref new DispatchedHandler([=]() {
reloadAccountList();
registrationStateErrorGeneric(account_id);
setLoadingStatusText(Utils::toPlatformString("Failed to register account: " + state), "#ffff0000");
// ajoute cet event dans le wizard
}));
}
......@@ -572,13 +580,16 @@ RingD::registerCallbacks()
}*/
}));
}),
DRing::exportable_callback<DRing::Debug::MessageSend>([&](const std::string& toto)
DRing::exportable_callback<DRing::Debug::MessageSend>([&](const std::string& msg)
{
if (debugModeOn_)
if (debugModeOn_) {
dispatcher->RunAsync(CoreDispatcherPriority::High,
ref new DispatchedHandler([=]() {
DMSG_(toto);
}));
ref new DispatchedHandler([=]() {
std::string displayMsg = msg.substr(56);
setLoadingStatusText(Utils::toPlatformString(displayMsg.substr(0,40) + "..."), "#ff000000");
DMSG_(msg);
}));
}
})
};
registerCallHandlers(callHandlers);
......
......@@ -42,6 +42,7 @@ delegate void RegisteredNameFound(LookupStatus status, const std::string& addres
delegate void FinishCaptureDeviceEnumeration();
delegate void RegistrationStateErrorGeneric(const std::string& accountId);
delegate void RegistrationStateRegistered();
delegate void SetLoadingStatusText(String^ statusText, String^ color);
delegate void CallsListRecieved(const std::vector<std::string>& callsList);
delegate void AudioMuted(const std::string& callId, bool state);
......@@ -156,6 +157,7 @@ internal:
event FinishCaptureDeviceEnumeration^ finishCaptureDeviceEnumeration;
event RegistrationStateErrorGeneric^ registrationStateErrorGeneric;
event RegistrationStateRegistered^ registrationStateRegistered;
event SetLoadingStatusText^ setLoadingStatusText;
event CallsListRecieved^ callsListRecieved; // est implemente a la base pour regler le probleme du boutton d'appel qui est present lorsqu'un appel est en cours, mais il n'est pas utilise. Voir si ca peut servir a autre chose
event AudioMuted^ audioMuted;
......
......@@ -276,6 +276,15 @@ genID(long long lower, long long upper)
return o.str();
}
Windows::UI::Color
ColorFromString(String^ s)
{
int a,r,g,b;
if (sscanf_s(Utils::toString(s).c_str(), "#%2x%2x%2x%2x", &a, &r, &g, &b) == 4)
return Windows::UI::ColorHelper::FromArgb(a, r, g, b);
else
return Windows::UI::ColorHelper::FromArgb(255, 0, 0, 0);
}
} /*namespace Utils*/
} /*namespace RingClientUWP*/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment