<commit_before>#######################################################
#
# ruboto.rb (by <NAME>)
#
# Wrapper for using RubotoActivity in Ruboto IRB
#
#######################################################

$RUBOTO_VERSION = 4

def confirm_ruboto_version(required_version, exact=true)
  raise "requires $RUBOTO_VERSION=#{required_version} or greater, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION < required_version and not exact
  raise "requires $RUBOTO_VERSION=#{required_version}, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION != required_version and exact
end

require 'java'

%w(Activity).each do |klass|
  java_import "org.ruboto.Ruboto#{klass}"
end


# Automate this?
#java_import "org.ruboto.embedded.RubotoView"

java_import "android.app.Activity"
java_import "android.content.Intent"
java_import "android.os.Bundle"

java_import "android.view.View"
java_import "android.view.ViewGroup"

java_import "android.widget.Toast"

java_import "android.widget.ArrayAdapter"
java_import "java.util.Arrays"
java_import "java.util.ArrayList"
java_import "android.R"

module Ruboto
  java_import "org.ruboto.R"
  Id = JavaUtilities.get_proxy_class("org.ruboto.R$id")
end
AndroidIds = JavaUtilities.get_proxy_class("android.R$id")

#############################################################################
#
# Activity
#

class Activity
  attr_accessor :init_block

  #dificult
  def start_ruboto_dialog(remote_variable, &block)
    start_ruboto_activity(remote_variable, true, &block)
  end

  #metaprogram so it works for everything
  def start_ruboto_activity(remote_variable, dialog=false, &block)
    @@init_block = block
<commit_msg>ruboto.rb tweak. it was assuming that R$id was defined, which is true in ruboto-irb but is not true in the base app generated by `android create project`<commit_after>#######################################################
#
# ruboto.rb (by <NAME>)
#
# Wrapper for using RubotoActivity in Ruboto IRB
#
#######################################################

$RUBOTO_VERSION = 4

def confirm_ruboto_version(required_version, exact=true)
  raise "requires $RUBOTO_VERSION=#{required_version} or greater, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION < required_version and not exact
  raise "requires $RUBOTO_VERSION=#{required_version}, current version #{$RUBOTO_VERSION}" if $RUBOTO_VERSION != required_version and exact
end

require 'java'

%w(Activity).each do |klass|
  java_import "org.ruboto.Ruboto#{klass}"
end


# Automate this?
#java_import "org.ruboto.embedded.RubotoView"

java_import "android.app.Activity"
java_import "android.content.Intent"
java_import "android.os.Bundle"

java_import "android.view.View"
java_import "android.view.ViewGroup"

java_import "android.widget.Toast"

java_import "android.widget.ArrayAdapter"
java_import "java.util.Arrays"
java_import "java.util.ArrayList"
java_import "android.R"

java_import "android.util.Log"

module Ruboto
  java_import "org.ruboto.R"
  begin
    Id = JavaUtilities.get_proxy_class("org.ruboto.R$id")
  rescue NameError
    Log.d "RUBOTO", "no R$id"
  end

end
AndroidIds = JavaUtilities.get_proxy_class("android.R$id")

#############################################################################
#
# Activity
#

class Activity
  attr_accessor :init_block

  #dificult
  def start_ruboto_dialog(remote_variable, &block)
    start_ruboto_activity(remote_variable, true, &block)
  end

  #metaprogram so it works for everything
  def start_ruboto_activity(remote_variable, dialog=false, &block)
    @@init_block = block

{'fraction_non_alphanumeric': 0.19752391671356218, 'fraction_numerical': 0.0005627462014631402, 'mean_word_length': 6.6781857451403885, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '644096', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1114, 'n_words': 252}