Permalink
Browse files

Add a background texture. Animate during nandroids. Fix dir count.

Change-Id: I9d03f72453d20ba8647b6f81821bf71004621011
  • Loading branch information...
koush committed Jul 16, 2012
1 parent c222b70 commit 79b3194734078fd89ed2199a9e0b18a2bb673ceb
View
@@ -42,6 +42,7 @@ void ui_set_nice(int enabled);
#define ui_nice_print(...) { ui_set_nice(1); ui_print(__VA_ARGS__); ui_set_nice(0); }
int ui_was_niced();
int ui_get_text_cols();
+void ui_increment_frame();
// Display some header text followed by a menu of items, which appears
// at the top of the screen (in place of any scrolling ui_print()
View
@@ -78,6 +78,7 @@ static void nandroid_callback(const char* filename)
tmp[strlen(tmp) - 1] = NULL;
tmp[ui_get_text_cols() - 1] = '\0';
nandroid_files_count++;
+ ui_increment_frame();
ui_nice_print("%s\n", tmp);
if (!ui_was_niced() && nandroid_files_total != 0)
ui_set_progress((float)nandroid_files_count / (float)nandroid_files_total);
@@ -88,7 +89,7 @@ static void nandroid_callback(const char* filename)
static void compute_directory_stats(const char* directory)
{
char tmp[PATH_MAX];
- sprintf(tmp, "find %s | wc -l > /tmp/dircount", directory);
+ sprintf(tmp, "find %s | %s wc -l > /tmp/dircount", directory, strcmp(directory, "/data") == 0 && is_data_media() ? "grep -v /data/media |" : "");
__system(tmp);
char count_text[100];
FILE* f = fopen("/tmp/dircount", "r");
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
31 ui.c
@@ -70,6 +70,7 @@ static gr_surface *gInstallationOverlay;
static gr_surface *gProgressBarIndeterminate;
static gr_surface gProgressBarEmpty;
static gr_surface gProgressBarFill;
+static gr_surface gBackground;
static int ui_has_initialized = 0;
static int ui_log_stdout = 1;
@@ -84,6 +85,7 @@ static const struct { gr_surface* surface; const char *name; } BITMAPS[] = {
{ &gBackgroundIcon[BACKGROUND_ICON_FIRMWARE_ERROR], "icon_firmware_error" },
{ &gProgressBarEmpty, "progress_empty" },
{ &gProgressBarFill, "progress_fill" },
+ { &gBackground, "stitch" },
{ NULL, NULL },
};
@@ -156,8 +158,20 @@ static void draw_install_overlay_locked(int frame) {
static void draw_background_locked(int icon)
{
gPagesIdentical = 0;
- gr_color(0, 0, 0, 255);
- gr_fill(0, 0, gr_fb_width(), gr_fb_height());
+ // gr_color(0, 0, 0, 255);
+ // gr_fill(0, 0, gr_fb_width(), gr_fb_height());
+
+ {
+ int bw = gr_get_width(gBackground);
+ int bh = gr_get_height(gBackground);
+ int bx = 0;
+ int by = 0;
+ for (by = 0; by < gr_fb_height(); by += bh) {
+ for (bx = 0; bx < gr_fb_width(); bx += bw) {
+ gr_blit(gBackground, 0, 0, bw, bh, bx, by);
+ }
+ }
+ }
if (icon) {
gr_surface surface = gBackgroundIcon[icon];
@@ -680,19 +694,15 @@ void ui_print(const char *fmt, ...)
struct timeval curtime;
gettimeofday(&curtime, NULL);
long ms = delta_milliseconds(lastupdate, curtime);
- if (ms < 0) {
- lastupdate = curtime;
- ms = NICE_INTERVAL;
- }
- if (ms < NICE_INTERVAL) {
+ if (ms < NICE_INTERVAL && ms >= 0) {
ui_niced = 1;
return;
}
- lastupdate = curtime;
}
// This can get called before ui_init(), so be careful.
pthread_mutex_lock(&gUpdateMutex);
+ gettimeofday(&lastupdate, NULL);
if (text_rows > 0 && text_cols > 0) {
char *ptr;
for (ptr = buf; *ptr != '\0'; ++ptr) {
@@ -990,3 +1000,8 @@ void ui_delete_line() {
text_col = 0;
pthread_mutex_unlock(&gUpdateMutex);
}
+
+void ui_increment_frame() {
+ gInstallingFrame =
+ (gInstallingFrame + 1) % ui_parameters.installing_frames;
+}

0 comments on commit 79b3194

Please sign in to comment.