File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11class UI ::Navigation
22 attr_reader :root_screen
33
4+ #In pixels
5+ def self . bar_height
6+ value = Android ::Util ::TypedValue . new
7+ if UI . context . theme . resolveAttribute ( Android ::R ::Attr ::ActionBarSize , value , true )
8+ Android ::Util ::TypedValue . complexToDimensionPixelSize ( value . data , UI ::context . resources . displayMetrics )
9+ else
10+ resource_id = UI . context . resources . getIdentifier ( 'action_bar_default_height' , 'dimen' , 'android' )
11+ if resource_id
12+ UI . context . resources . getDimensionPixelSize ( resource_id )
13+ else
14+ 0
15+ end
16+ end
17+ end
18+
419 def initialize ( root_screen )
520 @root_screen = root_screen
621 @root_screen . navigation = self
@@ -17,7 +32,8 @@ def hide_bar
1732 bar . hide
1833 Task . after 0.05 do
1934 screen = @current_screens . last
20- screen . view . height += ( bar . height / UI . density )
35+ bar_height = bar . height >0 ? bar . height : self . class . bar_height
36+ screen . view . height += ( bar_height / UI . density )
2137 screen . view . update_layout
2238 end
2339 end
@@ -29,7 +45,8 @@ def show_bar
2945 bar . show
3046 Task . after 0.05 do
3147 screen = @current_screens . last
32- screen . view . height -= ( bar . height / UI . density )
48+ bar_height = bar . height >0 ? bar . height : self . class . bar_height
49+ screen . view . height -= ( bar_height / UI . density )
3350 screen . view . update_layout
3451 end
3552 end
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ def view
109109 if resource_id > 0
110110 view_height -= UI . context . resources . getDimensionPixelSize ( resource_id )
111111 end
112+ view_height -= UI ::Navigation . bar_height
112113
113114 view . width = main_screen_metrics . width / UI . density
114115 view . height = view_height / UI . density
You can’t perform that action at this time.
0 commit comments