<commit_before>motion_require 'base'

module Formotion
  module RowType
    class PagedimageRow < Base
      TAKE = BW.localized_string("Take", nil)
      DELETE = BW.localized_string("Delete", nil)
      CHOOSE = BW.localized_string("Choose", nil)
      CANCEL = BW.localized_string("Cancel", nil)

      include BW::KVO

      PAGE_VIEW_TAG=1110
      SCROLL_VIEW_TAG=1111

      def build_cell(cell)
        # only show the "plus" when editable
        add_plus_accessory(cell) if row.editable?
        
        @page_view     = UIPageControl.alloc.init
        @page_view.tag = PAGE_VIEW_TAG
        @page_view.pageIndicatorTintColor        = '#d0d0d0'.to_color
        @page_view.currentPageIndicatorTintColor = '#505050'.to_color
        @page_view.currentPage   = 0
        @page_view.numberOfPages = self.row.value.size
        @page_view.when(UIControlEventValueChanged) do
          page_width = @scroll_view.frame.size.width
          page=@page_view.currentPage
          offset=((page * page_width * 2.0 - page_width) / 2.0) + (page_width/2.0)<commit_msg>add idea url / bugfix<commit_after>motion_require 'base'

# ideas taken from:
# http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content

module Formotion
  module RowType
    class PagedimageRow < Base
      TAKE = BW.localized_string("Take", nil)
      DELETE = BW.localized_string("Delete", nil)
      CHOOSE = BW.localized_string("Choose", nil)
      CANCEL = BW.localized_string("Cancel", nil)

      include BW::KVO

      PAGE_VIEW_TAG=1110
      SCROLL_VIEW_TAG=1111

      def build_cell(cell)
        # only show the "plus" when editable
        add_plus_accessory(cell) if row.editable?
        
        self.row.value = [] unless self.row.value.is_a?(Array)
        
        @page_view     = UIPageControl.alloc.init
        @page_view.tag = PAGE_VIEW_TAG
        @page_view.pageIndicatorTintColor        = '#d0d0d0'.to_color
        @page_view.currentPageIndicatorTintColor = '#505050'.to_color
        @page_view.currentPage   = 0
        @page_view.numberOfPages = self.row.value.size
        @page_view.when(UIControlEventValueChanged) do
          page_width = @scroll_view.frame.size.width
          page=@page_view.currentPage
          offset=((page * page_width * 2.0 - page_width) / 2.0) + (page_width/2.0)
{'fraction_non_alphanumeric': 0.1032258064516129, 'fraction_numerical': 0.022795698924731184, 'mean_word_length': 2.7156549520766773, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2480095', 'n_tokens_mistral': 824, 'n_tokens_neox': 776, 'n_words': 127}