diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 2 | ||||
-rw-r--r-- | src/ios.m | 2 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 8 | ||||
-rw-r--r-- | src/ui/root.c | 26 | ||||
-rw-r--r-- | src/ui/root.h | 3 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 1 |
6 files changed, 33 insertions, 9 deletions
@@ -2027,7 +2027,7 @@ iBool handleCommand_App(const char *cmd) { | |||
2027 | else if (equal_Command(cmd, "hidetoolbarscroll")) { | 2027 | else if (equal_Command(cmd, "hidetoolbarscroll")) { |
2028 | d->prefs.hideToolbarOnScroll = arg_Command(cmd); | 2028 | d->prefs.hideToolbarOnScroll = arg_Command(cmd); |
2029 | if (!d->prefs.hideToolbarOnScroll) { | 2029 | if (!d->prefs.hideToolbarOnScroll) { |
2030 | showToolbars_Root(get_Root(), iTrue); | 2030 | showToolbar_Root(get_Root(), iTrue); |
2031 | } | 2031 | } |
2032 | return iTrue; | 2032 | return iTrue; |
2033 | } | 2033 | } |
@@ -327,7 +327,7 @@ iBool isPhone_iOS(void) { | |||
327 | } | 327 | } |
328 | 328 | ||
329 | int displayRefreshRate_iOS(void) { | 329 | int displayRefreshRate_iOS(void) { |
330 | return uiWindow_(get_Window()).screen.maximumFramesPerSecond; | 330 | return (int) uiWindow_(get_Window()).screen.maximumFramesPerSecond; |
331 | } | 331 | } |
332 | 332 | ||
333 | void setupWindow_iOS(iWindow *window) { | 333 | void setupWindow_iOS(iWindow *window) { |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3fc22bdf..bd624059 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1674,7 +1674,7 @@ static void scrollBegan_DocumentWidget_(iAnyObject *any, int offset, uint32_t du | |||
1674 | if (deviceType_App() == phone_AppDeviceType) { | 1674 | if (deviceType_App() == phone_AppDeviceType) { |
1675 | const float normPos = normScrollPos_DocumentWidget_(d); | 1675 | const float normPos = normScrollPos_DocumentWidget_(d); |
1676 | if (prefs_App()->hideToolbarOnScroll && iAbs(offset) > 5 && normPos >= 0) { | 1676 | if (prefs_App()->hideToolbarOnScroll && iAbs(offset) > 5 && normPos >= 0) { |
1677 | showToolbars_Root(as_Widget(d)->root, offset < 0); | 1677 | showToolbar_Root(as_Widget(d)->root, offset < 0); |
1678 | } | 1678 | } |
1679 | } | 1679 | } |
1680 | updateVisible_DocumentWidget_(d); | 1680 | updateVisible_DocumentWidget_(d); |
@@ -2840,7 +2840,11 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
2840 | if (d->flags & openedFromSidebar_DocumentWidgetFlag && | 2840 | if (d->flags & openedFromSidebar_DocumentWidgetFlag && |
2841 | !isVisible_Widget(findWidget_App("sidebar"))) { | 2841 | !isVisible_Widget(findWidget_App("sidebar"))) { |
2842 | postCommand_App("sidebar.toggle"); | 2842 | postCommand_App("sidebar.toggle"); |
2843 | showToolbars_Root(get_Root(), iTrue); | 2843 | showToolbar_Root(get_Root(), iTrue); |
2844 | #if defined (iPlatformAppleMobile) | ||
2845 | /* TODO: Add a softer tap? */ | ||
2846 | // playHapticEffect_iOS(tap_HapticEffect); | ||
2847 | #endif | ||
2844 | return iTrue; | 2848 | return iTrue; |
2845 | } | 2849 | } |
2846 | d->flags &= ~openedFromSidebar_DocumentWidgetFlag; | 2850 | d->flags &= ~openedFromSidebar_DocumentWidgetFlag; |
diff --git a/src/ui/root.c b/src/ui/root.c index 0a5eb96e..6c00db0f 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -514,6 +514,24 @@ void updatePadding_Root(iRoot *d) { | |||
514 | #endif | 514 | #endif |
515 | } | 515 | } |
516 | 516 | ||
517 | void updateToolbarColors_Root(iRoot *d) { | ||
518 | #if defined (iPlatformMobile) | ||
519 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); | ||
520 | if (toolBar) { | ||
521 | const iBool isSidebarVisible = isVisible_Widget(findChild_Widget(d->widget, "sidebar")); | ||
522 | setBackgroundColor_Widget(toolBar, isSidebarVisible ? uiBackgroundSidebar_ColorId : | ||
523 | tmBannerBackground_ColorId); | ||
524 | iForEach(ObjectList, i, children_Widget(toolBar)) { | ||
525 | iLabelWidget *btn = i.object; | ||
526 | setTextColor_LabelWidget(i.object, isSidebarVisible ? uiTextDim_ColorId : | ||
527 | tmBannerIcon_ColorId); | ||
528 | } | ||
529 | } | ||
530 | #else | ||
531 | iUnused(d); | ||
532 | #endif | ||
533 | } | ||
534 | |||
517 | void dismissPortraitPhoneSidebars_Root(iRoot *d) { | 535 | void dismissPortraitPhoneSidebars_Root(iRoot *d) { |
518 | if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { | 536 | if (deviceType_App() == phone_AppDeviceType && isPortrait_App()) { |
519 | iWidget *sidebar = findChild_Widget(d->widget, "sidebar"); | 537 | iWidget *sidebar = findChild_Widget(d->widget, "sidebar"); |
@@ -1247,7 +1265,6 @@ void createUserInterface_Root(iRoot *d) { | |||
1247 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag | | 1265 | arrangeHeight_WidgetFlag | arrangeHorizontal_WidgetFlag | |
1248 | commandOnClick_WidgetFlag | | 1266 | commandOnClick_WidgetFlag | |
1249 | drawBackgroundToBottom_WidgetFlag, iTrue); | 1267 | drawBackgroundToBottom_WidgetFlag, iTrue); |
1250 | setBackgroundColor_Widget(toolBar, tmBannerBackground_ColorId); | ||
1251 | setId_Widget(addChildFlags_Widget(toolBar, | 1268 | setId_Widget(addChildFlags_Widget(toolBar, |
1252 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), | 1269 | iClob(newLargeIcon_LabelWidget("\U0001f870", "navigate.back")), |
1253 | frameless_WidgetFlag), | 1270 | frameless_WidgetFlag), |
@@ -1269,12 +1286,13 @@ void createUserInterface_Root(iRoot *d) { | |||
1269 | setFont_LabelWidget(menuButton, uiLabelLarge_FontId); | 1286 | setFont_LabelWidget(menuButton, uiLabelLarge_FontId); |
1270 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); | 1287 | setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); |
1271 | addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag); | 1288 | addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag); |
1289 | // setBackgroundColor_Widget(toolBar, tmBannerBackground_ColorId); | ||
1272 | iForEach(ObjectList, i, children_Widget(toolBar)) { | 1290 | iForEach(ObjectList, i, children_Widget(toolBar)) { |
1273 | iLabelWidget *btn = i.object; | 1291 | iLabelWidget *btn = i.object; |
1274 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); | 1292 | setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); |
1275 | setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); | 1293 | // setTextColor_LabelWidget(i.object, tmBannerIcon_ColorId); |
1276 | // setBackgroundColor_Widget(i.object, tmBannerSideTitle_ColorId); | ||
1277 | } | 1294 | } |
1295 | updateToolbarColors_Root(d); | ||
1278 | const iMenuItem items[] = { | 1296 | const iMenuItem items[] = { |
1279 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, | 1297 | { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, |
1280 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, | 1298 | { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, |
@@ -1356,7 +1374,7 @@ void createUserInterface_Root(iRoot *d) { | |||
1356 | } | 1374 | } |
1357 | } | 1375 | } |
1358 | 1376 | ||
1359 | void showToolbars_Root(iRoot *d, iBool show) { | 1377 | void showToolbar_Root(iRoot *d, iBool show) { |
1360 | /* The toolbar is only used on phone portrait layout. */ | 1378 | /* The toolbar is only used on phone portrait layout. */ |
1361 | if (isLandscape_App()) return; | 1379 | if (isLandscape_App()) return; |
1362 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); | 1380 | iWidget *toolBar = findChild_Widget(d->widget, "toolbar"); |
diff --git a/src/ui/root.h b/src/ui/root.h index 96864a15..740e97c9 100644 --- a/src/ui/root.h +++ b/src/ui/root.h | |||
@@ -34,7 +34,8 @@ void postArrange_Root (iRoot *); | |||
34 | void updateMetrics_Root (iRoot *); | 34 | void updateMetrics_Root (iRoot *); |
35 | void updatePadding_Root (iRoot *); /* TODO: is part of metrics? */ | 35 | void updatePadding_Root (iRoot *); /* TODO: is part of metrics? */ |
36 | void dismissPortraitPhoneSidebars_Root (iRoot *); | 36 | void dismissPortraitPhoneSidebars_Root (iRoot *); |
37 | void showToolbars_Root (iRoot *, iBool show); | 37 | void showToolbar_Root (iRoot *, iBool show); |
38 | void updateToolbarColors_Root (iRoot *); | ||
38 | 39 | ||
39 | iInt2 size_Root (const iRoot *); | 40 | iInt2 size_Root (const iRoot *); |
40 | iRect rect_Root (const iRoot *); | 41 | iRect rect_Root (const iRoot *); |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index f7181037..5b836670 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -971,6 +971,7 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
971 | w, -w->rect.size.x - safePad, 300, easeOut_AnimFlag | softer_AnimFlag); | 971 | w, -w->rect.size.x - safePad, 300, easeOut_AnimFlag | softer_AnimFlag); |
972 | } | 972 | } |
973 | } | 973 | } |
974 | updateToolbarColors_Root(w->root); | ||
974 | arrange_Widget(w->parent); | 975 | arrange_Widget(w->parent); |
975 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ | 976 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ |
976 | arrange_Widget(w); | 977 | arrange_Widget(w); |