-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Added @UsesFeatures annotation #3570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jewelshkjony
wants to merge
4
commits into
mit-cml:master
Choose a base branch
from
jewelshkjony:feature-add/uses-feature
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
appinventor/components/src/com/google/appinventor/components/annotations/UsesFeatures.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// -*- mode: java; c-basic-offset: 2; -*- | ||
// Copyright 2025 MIT, All rights reserved | ||
// Released under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package com.google.appinventor.components.annotations; | ||
|
||
import com.google.appinventor.components.annotations.androidmanifest.FeatureElement; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Declares hardware or software features that is used by a component. | ||
* | ||
* @author https://github.com/jewelshkjony (Jewel Shikder Jony) | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface UsesFeatures { | ||
|
||
/** | ||
* The values of the features (as an array) | ||
* | ||
* @return the array of elements data | ||
*/ | ||
FeatureElement[] features(); | ||
} |
54 changes: 54 additions & 0 deletions
54
...nts/src/com/google/appinventor/components/annotations/androidmanifest/FeatureElement.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// -*- mode: java; c-basic-offset: 2; -*- | ||
// Copyright 2025 MIT, All rights reserved | ||
// Released under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
package com.google.appinventor.components.annotations.androidmanifest; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Annotation to describe an <uses-feature> element required by a component | ||
* so that it can be added to AndroidManifest.xml. | ||
* | ||
* @author https://github.com/jewelshkjony (Jewel Shikder Jony) | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface FeatureElement { | ||
|
||
/** | ||
* Specifies a single hardware or software feature used by the application as a descriptor string. | ||
* Valid attribute values are listed in the | ||
* <a href="https://developer.android.com/guide/topics/manifest/uses-feature-element#hw-features">Hardware features</a> | ||
* and <a href="https://developer.android.com/guide/topics/manifest/uses-feature-element#sw-features">Software features</a> sections. | ||
* These attribute values are case-sensitive. | ||
* | ||
* @return the name of the element | ||
*/ | ||
String name(); | ||
|
||
/** | ||
* Boolean value that indicates whether the application requires the featureContents of the xml file. | ||
* Declaring true for a feature indicates that the application can't function, | ||
* or isn't designed to function, when the specified feature isn't present on the device. | ||
* Declaring false for a feature indicates that the application uses the feature if present on the device, | ||
* but that it is designed to function without the specified feature if necessary. | ||
* | ||
* @return Returns true if required otherwise false | ||
*/ | ||
boolean required() default true; | ||
jewelshkjony marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
/** | ||
* The OpenGL ES version required by the application. The higher 16 bits represent the major | ||
* number and the lower 16 bits represent the minor number. For example, to specify OpenGL | ||
* ES version 2.0, you set the value as "0x00020000", or to specify OpenGL ES 3.2, | ||
* you set the value as "0x00030002". | ||
* | ||
* @return the glEs version | ||
*/ | ||
int glEsVersion() default -1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.