Skip to content

Commit

Permalink
Add support for having searcher as an item in list and grids
Browse files Browse the repository at this point in the history
  • Loading branch information
andoma committed May 1, 2016
1 parent 8ba085f commit 1dd2b5e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 45 deletions.
3 changes: 3 additions & 0 deletions glwskins/flat/items/list/search.view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "skin:https://theme.view"

SearchBar($self.url, $self.metadata.title);
3 changes: 3 additions & 0 deletions glwskins/flat/items/rect/search.view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "skin:https://theme.view"

SearchBar($self.url, $self.metadata.title);
49 changes: 5 additions & 44 deletions glwskins/flat/pages/home.view
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,6 @@ style(sidebarBackdrop, {
alpha: 0.3;
});

#define SEARCHBAR() {
widget(container_x, {
spacing: 1em;
divider: true;
padding: 1em;
widget(container_z, {

filterConstraintX: true;
widget(quad, {
fhpSpill: true;
zoffset: -400;
color: 0;
});

widget(container_x, {
height: 2em;
padding: [0.5em, 0];
spacing: 0.5em;
widget(icon, {
fhpSpill: true;
size: 1.2em;
source: "skin:https://icons/ic_search_48px.svg";
alpha: 0.4 + isFocused();
});

widget(text, {
padding: [0, 0.5em];
style: "ListItemValue";
size: 1.2em;
font: "skin:https://fonts/RobotoCondensed-Regular.ttf";
focusable: 0.1;

bind($view.searchQuery);
onEvent(enter, navOpen("search:" + $view.searchQuery),
$view.searchQuery);
onEvent(submit, navOpen("search:" + $view.searchQuery),
$view.searchQuery);
});
});
});
});
}


#define NEWSSTAND() {
cloner($core.news, container_x, {
Expand Down Expand Up @@ -143,8 +100,12 @@ widget(container_z, {
childTilesX: select($ui.aspect > 1, 5, 2);
childTilesY: 4;

style(ListItem, {
padding: [0, 1em];
});

NEWSSTAND();
SEARCHBAR();
SearchBar("search:");

cloner($core.services.stable, container_z, {

Expand Down
2 changes: 1 addition & 1 deletion glwskins/flat/pages/list.view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ widget(container_z, {
chaseFocus: true;

clipOffsetTop: 3em;
scrollThresholdTop: 5em;
scrollThresholdTop: 4em;

scrollThresholdBottom: $ui.universeBottomHeight + 2em;
clipOffsetBottom: $ui.universeBottomHeight;
Expand Down
53 changes: 53 additions & 0 deletions glwskins/flat/theme.view
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,56 @@
});
});
}


#define SearchBar(URLPREFIX, TEXT=void, ICON=void) {
widget(container_x, {
style: "ListItem";
divider: true;
widget(container_z, {

filterConstraintX: true;
widget(quad, {
color: 0;
});

widget(container_x, {
height: 2em;
padding: [0.5em, 0];
spacing: 0.5em;
widget(icon, {
fhpSpill: true;
size: 1.2em;
source: "skin:https://icons/ic_search_48px.svg";
alpha: 0.4 + isFocused();
});

zbox({
filterConstraintX: true;
label({
hidden: select($view.searchQuery, true, false);
caption: TEXT;
size: 1.2em;
font: "skin:https://fonts/RobotoCondensed-Regular.ttf";
color: 0.5;
});

widget(text, {
filterConstraintX: true;
padding: [0, 0.4em];
size: 1.2em;
font: "skin:https://fonts/RobotoCondensed-Regular.ttf";
focusable: 0.1;

bind($view.searchQuery);
onEvent(enter, navOpen(URLPREFIX + $view.searchQuery),
$view.searchQuery);
onEvent(submit, navOpen(URLPREFIX + $view.searchQuery),
$view.searchQuery);
});
});
});
});
});
}

0 comments on commit 1dd2b5e

Please sign in to comment.