-
-
Notifications
You must be signed in to change notification settings - Fork 755
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
Simplified the StartsActivity by reducing the number of parameters through POJO class #579
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4140e33
Simplified the StartsActivity by reducing the number of parameters th…
email2vimalraj 9288d33
Addressed review comments
email2vimalraj bf96700
Added javadoc for the constructor.
email2vimalraj 869dcde
Fixed usage instructions
email2vimalraj 42c64d5
Added a check to prevent Activity parameters not empty and not null. …
email2vimalraj 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 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
188 changes: 188 additions & 0 deletions
188
src/main/java/io/appium/java_client/android/Activity.java
This file contains 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,188 @@ | ||
package io.appium.java_client.android; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static org.apache.commons.lang3.StringUtils.isBlank; | ||
|
||
/** | ||
* This is a simple POJO class to support the {@link StartsActivity}. | ||
*/ | ||
public class Activity { | ||
private final String appPackage; | ||
private final String appActivity; | ||
private String appWaitPackage; | ||
private String appWaitActivity; | ||
private String intentAction; | ||
private String intentCategory; | ||
private String intentFlags; | ||
private String optionalIntentArguments; | ||
private boolean stopApp; | ||
|
||
/** | ||
* A constructor with two mandatory parameters. | ||
* | ||
* @param appPackage The value for the app package. | ||
* @param appActivity The value for the app activity. | ||
*/ | ||
public Activity(String appPackage, String appActivity) { | ||
checkArgument(!isBlank(appPackage), | ||
"App package should be defined as not empty or null string"); | ||
checkArgument(!isBlank(appActivity), | ||
"App activity should be defined as not empty or null string"); | ||
this.appPackage = appPackage; | ||
this.appActivity = appActivity; | ||
this.stopApp = true; | ||
} | ||
|
||
/** | ||
* Gets the app package value. | ||
* | ||
* @return The app package value. | ||
*/ | ||
public String getAppPackage() { | ||
return appPackage; | ||
} | ||
|
||
/** | ||
* Gets the app activity value. | ||
* | ||
* @return The app activity value. | ||
*/ | ||
public String getAppActivity() { | ||
return appActivity; | ||
} | ||
|
||
/** | ||
* Gets the app wait package value. | ||
* | ||
* @return The app wait package value. | ||
*/ | ||
public String getAppWaitPackage() { | ||
return appWaitPackage; | ||
} | ||
|
||
/** | ||
* Sets the app wait package value. | ||
* | ||
* @param appWaitPackage The app wait package value. | ||
*/ | ||
public void setAppWaitPackage(String appWaitPackage) { | ||
this.appWaitPackage = appWaitPackage; | ||
} | ||
|
||
/** | ||
* Gets the app wait activity value. | ||
* | ||
* @return The app wait activity value. | ||
*/ | ||
public String getAppWaitActivity() { | ||
return appWaitActivity; | ||
} | ||
|
||
/** | ||
* Sets the app wait activity value. | ||
* | ||
* @param appWaitActivity The app wait activity value. | ||
*/ | ||
public void setAppWaitActivity(String appWaitActivity) { | ||
this.appWaitActivity = appWaitActivity; | ||
} | ||
|
||
/** | ||
* Gets the intent action value. | ||
* | ||
* @return The intent action value. | ||
*/ | ||
public String getIntentAction() { | ||
return intentAction; | ||
} | ||
|
||
/** | ||
* Sets the intent action value. | ||
* | ||
* @param intentAction The intent action value. | ||
*/ | ||
public void setIntentAction(String intentAction) { | ||
this.intentAction = intentAction; | ||
} | ||
|
||
/** | ||
* Gets the intent category value. | ||
* | ||
* @return The intent category value. | ||
*/ | ||
public String getIntentCategory() { | ||
return intentCategory; | ||
} | ||
|
||
/** | ||
* Sets the intent category value. | ||
* | ||
* @param intentCategory The intent category value. | ||
*/ | ||
public void setIntentCategory(String intentCategory) { | ||
this.intentCategory = intentCategory; | ||
} | ||
|
||
/** | ||
* Gets the intent flags value. | ||
* | ||
* @return The intent flags value. | ||
*/ | ||
public String getIntentFlags() { | ||
return intentFlags; | ||
} | ||
|
||
/** | ||
* Sets the intent flags value. | ||
* | ||
* @param intentFlags The intent flags value. | ||
*/ | ||
public void setIntentFlags(String intentFlags) { | ||
this.intentFlags = intentFlags; | ||
} | ||
|
||
/** | ||
* Gets the optional intent arguments value. | ||
* | ||
* @return The optional intent arguments value. | ||
*/ | ||
public String getOptionalIntentArguments() { | ||
return optionalIntentArguments; | ||
} | ||
|
||
/** | ||
* Sets the optional intent arguments value. | ||
* | ||
* @param optionalIntentArguments The optional intent arguments value. | ||
*/ | ||
public void setOptionalIntentArguments(String optionalIntentArguments) { | ||
this.optionalIntentArguments = optionalIntentArguments; | ||
} | ||
|
||
/** | ||
* Gets the stop app value. | ||
* | ||
* @return The stop app value. | ||
*/ | ||
public boolean isStopApp() { | ||
return stopApp; | ||
} | ||
|
||
/** | ||
* Sets the stop app value. | ||
* | ||
* @param stopApp The stop app value. | ||
*/ | ||
public void setStopApp(boolean stopApp) { | ||
this.stopApp = stopApp; | ||
} | ||
|
||
@Override public String toString() { | ||
return "Activity{" + "appPackage='" + appPackage + '\'' + ", appActivity='" + appActivity | ||
+ '\'' + ", appWaitPackage='" + appWaitPackage + '\'' + ", appWaitActivity='" | ||
+ appWaitActivity + '\'' + ", intentAction='" + intentAction + '\'' | ||
+ ", intentCategory='" + intentCategory + '\'' + ", intentFlags='" + intentFlags + '\'' | ||
+ ", optionalIntentArguments='" + optionalIntentArguments + '\'' + ", stopApp=" | ||
+ stopApp + '}'; | ||
} | ||
} |
This file contains 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 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 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 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I this this POJO should have 2 mandatory parameteres: package and activity. Please add the constructor with these parameters.