-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from kaeppler/manifest-update
Add support for writing the supports-screens and compatible-screens elements from manifest-update mojo
- Loading branch information
Showing
13 changed files
with
566 additions
and
29 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/com/jayway/maven/plugins/android/common/XmlHelper.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,29 @@ | ||
package com.jayway.maven.plugins.android.common; | ||
|
||
import org.w3c.dom.Document; | ||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
|
||
public class XmlHelper { | ||
|
||
public static void removeDirectChildren(Node parent) { | ||
NodeList childNodes = parent.getChildNodes(); | ||
while (childNodes.getLength() > 0) { | ||
parent.removeChild(childNodes.item(0)); | ||
} | ||
} | ||
|
||
public static Element getOrCreateElement(Document doc, Element manifestElement, | ||
String elementName) { | ||
NodeList nodeList = manifestElement.getElementsByTagName(elementName); | ||
Element element = null; | ||
if (nodeList.getLength() == 0) { | ||
element = doc.createElement(elementName); | ||
manifestElement.appendChild(element); | ||
} else { | ||
element = (Element) nodeList.item(0); | ||
} | ||
return element; | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
src/main/java/com/jayway/maven/plugins/android/standalonemojos/CompatibleScreen.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,42 @@ | ||
package com.jayway.maven.plugins.android.standalonemojos; | ||
|
||
public class CompatibleScreen { | ||
|
||
private String screenSize, screenDensity; | ||
|
||
public String getScreenSize() { | ||
return screenSize; | ||
} | ||
|
||
public void setScreenSize(String screenSize) { | ||
this.screenSize = screenSize; | ||
} | ||
|
||
public String getScreenDensity() { | ||
return screenDensity; | ||
} | ||
|
||
public void setScreenDensity(String screenDensity) { | ||
this.screenDensity = screenDensity; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (obj instanceof CompatibleScreen) { | ||
CompatibleScreen that = (CompatibleScreen) obj; | ||
return this.screenDensity.equals(that.screenDensity) | ||
&& this.screenSize.equals(that.screenSize); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return (screenDensity + screenSize).hashCode(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return screenSize + ":" + screenDensity; | ||
} | ||
} |
Oops, something went wrong.