screenviews.kv 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. #:import LinearRecycleLayoutManager kivy.garden.recycleview.LinearRecycleLayoutManager
  2. # Goblinoid: Experience all of MediaGoblin on an Android Device
  3. # Copyright (C) 2015 Dylan Jeffers
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # box layout for each activity in feed
  18. <FeedLayout>
  19. id: feed_layout
  20. padding: 20
  21. orientation: 'vertical'
  22. BoxLayout:
  23. size_hint: (1.0, 0.05)
  24. orientation: 'horizontal'
  25. Button:
  26. halign: 'left'
  27. text: root.actor
  28. on_release: root.open_profile_modal()
  29. Label:
  30. halign: 'right'
  31. text: '{0} hrs, {1} min'.format(root.post_time[0], root.post_time[1])
  32. RelativeLayout:
  33. orientation: 'horizontal'
  34. # size_hint_y: None
  35. # Note: change this to wrap activity text
  36. size_hint: (1.0, 0.6)
  37. id: content
  38. ScrollView:
  39. size: self.size
  40. opacity: 1 if root.note_content else 0
  41. Label:
  42. size_hint_y: None
  43. text_size: self.width, None
  44. height: self.texture_size[1]
  45. text: root.note_content
  46. valight: 'middle'
  47. background_color:
  48. AsyncImage:
  49. size_hint_x: None
  50. source: root.image_content
  51. allow_stretch: True
  52. keep_ratio: True
  53. width: content.width
  54. opacity: 1 if root.image_content else 0
  55. Button:
  56. size_hint_x: None
  57. width: content.width
  58. text: root.else_content
  59. opacity: 1 if root.else_content else 0
  60. BoxLayout:
  61. size_hint: (1.0, 0.05)
  62. orientation: 'horizontal'
  63. Button:
  64. text: 'like'
  65. Button:
  66. text: 'comment'
  67. on_release: root.open_comment_modal()
  68. Button:
  69. text: 'share'
  70. on_release: root.share_activity()
  71. Button:
  72. text: 'report'
  73. on_release: root.report_activity()
  74. BoxLayout:
  75. size_hint_y: 0.3
  76. orientation: 'vertical'
  77. Label:
  78. text: root.likes
  79. Label:
  80. size_hint_y: 0.5
  81. text: root.description if root.description else 'no description'
  82. text_size: root.width, self.height
  83. valign: 'middle'
  84. BoxLayout:
  85. orientation: 'horizontal'
  86. # Note: this will eventually not be hard-coded
  87. Label:
  88. max_lines: 1
  89. size_hint_x: 0.2
  90. text_size: self.size
  91. text: '{0}'.format(root.comments[0]["author"])
  92. Label:
  93. max_lines: 1
  94. valign: 'middle'
  95. text_size: self.size
  96. text: '{0}'.format(root.comments[0]["content"])
  97. Button:
  98. text: 'view all {0} comments'.format(len(root.comments))
  99. on_release: root.open_comment_modal()
  100. <FeedView>:
  101. BoxLayout:
  102. orientation: 'vertical'
  103. RecycleView:
  104. size_hint_y: 1
  105. opacity: 1 if root.data else 0
  106. layout_manager: LinearRecycleLayoutManager(orientation="vertical",default_size=self.height)
  107. data: root.data
  108. viewclass: 'FeedLayout'
  109. #root view for gallery, photo, video, and upload subviews
  110. <MediaView>
  111. msm: msm
  112. #Note: No BoxLayout allows MediaView to take up full screen
  113. BoxLayout:
  114. orientation: 'vertical'
  115. ScreenManager:
  116. size_hint: (1.0, 0.9)
  117. id: msm
  118. BoxLayout:
  119. size_hint: (1.0, 0.1)
  120. Button:
  121. text: 'gallery'
  122. on_release: root.open_media_view('gallery', True)
  123. Button:
  124. text: 'camera'
  125. on_release: root.open_media_view('camera', False)
  126. Button:
  127. text: 'video'
  128. on_release: root.open_media_view('camcorder', False)
  129. <ProfileModalView>
  130. BoxLayout:
  131. orientation: 'vertical'
  132. BoxLayout:
  133. size_hint_y: 0.1
  134. orientation: 'horizontal'
  135. Button:
  136. size_hint_x: 0.2
  137. text: 'exit'
  138. on_release: root.dismiss()
  139. Label:
  140. text: str(root.profile.display_name) if root.profile else ''
  141. Button:
  142. size_hint_x: 0.2
  143. text: 'Log Out'
  144. on_release: root.log_out()
  145. TabbedProfilePanel:
  146. profile: root.profile
  147. <TabbedProfilePanel>:
  148. activity_grid: activity_grid
  149. follower_grid: follower_grid
  150. following_grid: following_grid
  151. do_default_tab: False
  152. tab_pos: 'top_mid'
  153. TabbedPanelItem:
  154. text: 'activity'
  155. BoxLayout:
  156. orientation: 'vertical'
  157. ScrollView:
  158. size: self.size
  159. GridLayout:
  160. id: activity_grid
  161. cols: 1
  162. size_hint_y: None
  163. row_default_height: 200
  164. TabbedPanelItem:
  165. text: 'followers'
  166. BoxLayout:
  167. orientation: 'vertical'
  168. ScrollView:
  169. size: self.size
  170. GridLayout:
  171. id: follower_grid
  172. cols: 1
  173. size_hint_y: None
  174. row_default_height: 200
  175. TabbedPanelItem:
  176. text: 'following'
  177. BoxLayout:
  178. orientation: 'vertical'
  179. ScrollView:
  180. size: self.size
  181. GridLayout:
  182. id: following_grid
  183. cols: 1
  184. size_hint_y: None
  185. row_default_height: 200
  186. <SettingsView>
  187. BoxLayout:
  188. orientation:'vertical'
  189. ActionBar:
  190. pos_hint: {'top':1}
  191. ActionView:
  192. use_separator: True
  193. ActionPrevious:
  194. title: 'MediaGoblin'
  195. with_previous: False
  196. ActionOverflow:
  197. ActionButton:
  198. on_release: app.open_feed(self)
  199. text: 'Feed'
  200. Label:
  201. text: 'User Name'
  202. <CommentModalView>:
  203. comment_layout: comment_layout
  204. BoxLayout:
  205. orientation: 'vertical'
  206. auto_dismiss: False
  207. AnchorLayout:
  208. size_hint_y: 0.05
  209. anchor_y: 'top'
  210. Button:
  211. text: 'exit'
  212. on_release: root.dismiss()
  213. ScrollView:
  214. size_hint_y: 0.9
  215. size: self.size
  216. GridLayout:
  217. id: comment_layout
  218. cols: 1
  219. size_hint_y: None
  220. row_default_height: 300
  221. AnchorLayout:
  222. size_hint_y: 0.05
  223. anchor_y: 'bottom'
  224. BoxLayout:
  225. orientation: 'horizontal'
  226. TextInput:
  227. id: comment_input
  228. hint_text: 'comment'
  229. height: self.minimum_height
  230. Button:
  231. size_hint_x: 0.1
  232. text: 'post'
  233. on_release: root.post_comment(comment_input.text)
  234. <ActivityDescriptionCell>:
  235. orientation: 'horizontal'
  236. padding: [0,10,0,30]
  237. Label:
  238. size_hint_x: None
  239. text: str(root.actor) if root.actor else ''
  240. text_size: self.size
  241. Label:
  242. size_hint_y: None
  243. text_size: self.width, None
  244. height: self.texture_size[1]
  245. text: str(root.description) if root.description else ''
  246. <CommentModalViewCell>
  247. orientation: 'horizontal'
  248. padding: [0,10,0,10]
  249. Button:
  250. size_hint_x: None
  251. text: str(root.comment.author) if root.comment else 'no author'
  252. text_size: self.size
  253. valign: 'middle'
  254. on_release: root.open_profile_modal()
  255. ScrollView:
  256. size: self.size
  257. Label:
  258. size_hint_y: None
  259. text_size: self.width, None
  260. height: self.texture_size[1]
  261. text: root.comment.content if root.comment else 'no comment'
  262. # the following activity content types may be moved to a different kv
  263. # file in the future
  264. <ANote>:
  265. text_size: self.width, None
  266. valign: 'middle'
  267. halign: 'center'
  268. height: self.texture_size[1]
  269. <AImage>: