Class: Android::Manifest::Activity

Inherits:
Component
  • Object
show all
Defined in:
lib/android/manifest.rb

Direct Known Subclasses

ActivityAlias

Constant Summary

Constants inherited from Component

Component::TYPES

Instance Attribute Summary

Attributes inherited from Component

#elem, #icon_id, #intent_filters, #metas, #name, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Android::Manifest::Component

Class Method Details

.valid?(elem) ⇒ Boolean

the element is valid Activity element or not

Parameters:

  • elem (REXML::Element)

    xml element

Returns:

  • (Boolean)


84
85
86
87
88
# File 'lib/android/manifest.rb', line 84

def self.valid?(elem)
  ['activity', 'activity-alias'].include?(elem.name.downcase)
rescue
  false
end

Instance Method Details

#default_launcher_activity?Boolean

Returns whether this instance is the default main launcher activity.

Returns:

  • (Boolean)

    whether this instance is the default main launcher activity.



98
99
100
101
102
103
# File 'lib/android/manifest.rb', line 98

def default_launcher_activity?
  intent_filters.any? do |intent_filter|
    intent_filter.exist?('android.intent.category.LAUNCHER') &&
    intent_filter.exist?('android.intent.category.DEFAULT')
  end
end

#launcher_activity?Boolean

Returns whether this instance is the launcher activity.

Returns:

  • (Boolean)

    whether this instance is the launcher activity.



91
92
93
94
95
# File 'lib/android/manifest.rb', line 91

def launcher_activity?
  intent_filters.any? do |intent_filter|
    intent_filter.exist?('android.intent.category.LAUNCHER')
  end
end