1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/. */
13 #include "android/log.h"
15 #include "progressui.h"
17 #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args)
19 int InitProgressUI(int *argc
, char ***argv
)
26 LOG("Starting to apply update ...\n");
32 LOG("Finished applying update\n");
35 void UpdateProgressUI(float progress
)
37 assert(0.0f
<= progress
&& progress
<= 100.0f
);
39 static const size_t kProgressBarLength
= 50;
40 static size_t sLastNumBars
;
41 size_t numBars
= size_t(float(kProgressBarLength
) * progress
/ 100.0f
);
42 if (numBars
== sLastNumBars
)
46 sLastNumBars
= numBars
;
48 size_t numSpaces
= kProgressBarLength
- numBars
;
49 std::string
bars(numBars
, '=');
50 std::string
spaces(numSpaces
, ' ');
51 LOG("Progress [ %s%s ]\n", bars
.c_str(), spaces
.c_str());