michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * vim: sw=2 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include michael@0: michael@0: #include "android/log.h" michael@0: michael@0: #include "progressui.h" michael@0: michael@0: #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args) michael@0: michael@0: using namespace std; michael@0: michael@0: int InitProgressUI(int *argc, char ***argv) michael@0: { michael@0: return 0; michael@0: } michael@0: michael@0: int ShowProgressUI() michael@0: { michael@0: LOG("Starting to apply update ...\n"); michael@0: return 0; michael@0: } michael@0: michael@0: void QuitProgressUI() michael@0: { michael@0: LOG("Finished applying update\n"); michael@0: } michael@0: michael@0: void UpdateProgressUI(float progress) michael@0: { michael@0: assert(0.0f <= progress && progress <= 100.0f); michael@0: michael@0: static const size_t kProgressBarLength = 50; michael@0: static size_t sLastNumBars; michael@0: size_t numBars = size_t(float(kProgressBarLength) * progress / 100.0f); michael@0: if (numBars == sLastNumBars) { michael@0: return; michael@0: } michael@0: sLastNumBars = numBars; michael@0: michael@0: size_t numSpaces = kProgressBarLength - numBars; michael@0: string bars(numBars, '='); michael@0: string spaces(numSpaces, ' '); michael@0: LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str()); michael@0: }