[MOD] More accurate Signal & WiFi strengths in status bar - Galaxy Tab Android Development

I am using Overcome ROM v1.4.2 and I have modified some framework files to show the network signal strength more accurately in the status bar.
The dBm value ranges from -113 (worst) to -51 (best), where -113 is equivalent to an ASU of 0, and -53 an ASU of 31.
if (asu <= 2 || asu == 99) bars = 0;
else if (asu >= 12) bars = 4;
else if (asu >= 8) bars = 3;
else if (asu >= 5) bars = 2;
else bars = 1;
Click to expand...
Click to collapse
Unless changes have been made to these system-files in later versions of the ROM, this modification should also work on more recent Overcome releases (and other JMK-based ROMs). However, I have NOT checked this myself.
Also, note that this will remove any themes applied to these system-files. So, try this modification at your own risk. If something goes wrong, you can just push back the original files, so make sure you make a backup of these first.
Installation:
Extract the modified services.jar and framework-res.apk to your internal storage (/sdcard) and perform the commands through ADB in the order stated below:
adb shell mount -o remount,rw -t rfs /dev/block/stl9 /system
adb shell dd if=/sdcard/services.jar of=/system/framework/services.jar
adb shell dd if=/sdcard/framework-res.apk of=/system/framework/framework-res.apk
adb shell reboot
Click to expand...
Click to collapse
If you like the mod, themers get to it. The files in framework-res.apk (/res/drawable-hdpi/) can easily be swapped, e.g. with images for the ASU value instead of dBm (which honestly is quite unintuitive although accurate), or perhaps something more graphical like what we did for the Xperia X10.
Screenshots:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Downloads:
dBm
ASU
Graphical
If you experience any problems, I will try to correct them. But I think it should be stable. Enjoy!

I have developed this modification a little bit further. It now also shows WiFi strength as a percentage, with increments of 5%.
if (rssi <= -97.75) { percentage = <5%
} else if (rssi > -97.75 && rssi <= -95.5) { percentage = 5
} else if (rssi > -95.5 && rssi <= -93.25) { percentage = 10
} else if (rssi > -93.25 && rssi <= -91) { percentage = 15
} else if (rssi > -91 && rssi <= -88.75) { percentage = 20
} else if (rssi > -88.75 && rssi <= -86.5) { percentage = 25
} else if (rssi > -86.5 && rssi <= -84.25) { percentage = 30
} else if (rssi > -84.25 && rssi <= -82) { percentage = 35
} else if (rssi > -82 && rssi <= -79.75) { percentage = 40
} else if (rssi > -79.75 && rssi <= -77.5) { percentage = 45
} else if (rssi > -77.5 && rssi <= -75.25) { percentage = 50
} else if (rssi > -75.25 && rssi <= -73) { percentage = 55
} else if (rssi > -73 && rssi <= -70.75) { percentage = 60
} else if (rssi > -70.75 && rssi <= -68.5) { percentage = 65
} else if (rssi > -68.5 && rssi <= -66.25) { percentage = 70
} else if (rssi > -66.25 && rssi <= -64) { percentage = 75
} else if (rssi > -64 && rssi <= -61.75) { percentage = 80
} else if (rssi > -61.75 && rssi <= -59.5) { percentage = 85
} else if (rssi > -59.5 && rssi <= -57.25) { percentage = 90
} else if (rssi > -57.25 && rssi <= -55) { percentage = 95
} else if (rssi > -55) { percentage = 100
} else { percentage = <5
}
Click to expand...
Click to collapse
Installation:
Extract the modified services.jar and framework-res.apk to your internal storage (/sdcard) and perform the commands through ADB in the order stated below:
adb shell mount -o remount,rw -t rfs /dev/block/stl9 /system
adb shell dd if=/sdcard/services.jar of=/system/framework/services.jar
adb shell dd if=/sdcard/framework.jar of=/system/framework/framework.jar
adb shell dd if=/sdcard/framework-res.apk of=/system/framework/framework-res.apk
adb shell reboot
Click to expand...
Click to collapse
Screenshot:
Download:
WiFi & ASU

Reserved...

How can I port this mod to my HTC Evo 4G?

new upload site please
Can you post the files to a new uploader? Mega is closed.
Also. Will this work on a galaxy note?
Thanks

can someone do a cwm zip to flash.

Thank you for this. Can you upload it to google drive or dropbox if possible? Thanks

can you post a guide on how you did this? possible?

Related

Need help for a simple text app

I was wondering, if someone can guide to create a simple app which simplly displays some text on the middle of the screen and 2 buttons (Left and right arrow) to switch to the next or previous text.
I think someone just helped another user who was looking for help for something similar like me but I cannot find it.
Thanks
You can try out this sample code, starting from an empty silverlight project:
In the MainPage.xaml, add the following snippet inside the Grid element named "ContentPanel".
<TextBlock Name="tblkDisplay" Width="360" Height="100" VerticalAlignment="Top" Margin="0,200,0,0" TextAlignment="Center"></TextBlock>
<Button Name="btnBack" Width="160" Height="80" VerticalAlignment="Top" Margin="-200,308,0,0" Click="btnBack_Click">Back</Button>
<Button Name="btnForward" Width="160" Height="80" VerticalAlignment="Top" Margin="200,308,0,0" Click="btnForward_Click">Forward</Button>
This markup adds a TextBlock, and Forward and Back buttons to the page.
In the in the code-behind (MainPage.xaml.cs), use the following code:
Code:
private int _displayIndex; //position in list of text items to display
private List<string> _textItems; //List of text items to display
// Constructor
public MainPage()
{
InitializeComponent();
}
//Code that get called when the page is navigated to
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
_textItems = new List<string>();
//Add ten items to text list to display
for (int i = 0; i < 10; i++)
{
_textItems.Add("Item" + i.ToString());
}
//For the default, set to first position and display it
_displayIndex = 0;
tblkDisplay.Text = _textItems[_displayIndex];
}
//If not at the first position of the list decrement by one, otherwise move to end of the list
private void Back()
{
if (_displayIndex > 0)
{
_displayIndex--;
}
else
{
_displayIndex = _textItems.Count - 1;
}
}
//If not at the last position of the list increment by one, otherwise move to start of the list
private void Forward()
{
if (_displayIndex < _textItems.Count - 1)
{
_displayIndex++;
}
else
{
_displayIndex = 0;
}
}
private void ShowText()
{
if ((_textItems.Count > 0) //Make sure there are items in the collection to display
&& (_displayIndex < _textItems.Count) // Make sure the index is not higher than how many items in the collection
&& (_displayIndex >= 0)) //Make sure the index is zero or greater
{
tblkDisplay.Text = _textItems[_displayIndex];
}
else
{
tblkDisplay.Text = "No Items.";
}
}
private void btnBack_Click(object sender, RoutedEventArgs e)
{
Back();
ShowText();
}
private void btnForward_Click(object sender, RoutedEventArgs e)
{
Forward();
ShowText();
}

[Q] E/NotificationService : An error occurred profiling the notification.

Hi,
i'm constantly getting this error in my logcat. I've no idea what i can do to fix it. I'm using v.0.35 of Elk759's http://forum.xda-developers.com/showthread.php?t=1827934 CM10 Rom for htc desire. This error occurs since version 0.33.
Can you tell me to which app this notification service belongs? pid 456 belongs to "system_server", pid 539 belongs to "com.android.systemui" so i just can't delete the corresponding data.
Code:
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
E/NotificationService( 456): An error occurred profiling the notification.
E/NotificationService( 456): java.lang.NullPointerException
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationInternal(NotificationManagerService.java:1147)
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:983)
E/NotificationService( 456): at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:129)
E/NotificationService( 456): at android.os.Binder.execTransact(Binder.java:367)
E/NotificationService( 456): at dalvik.system.NativeStart.run(Native Method)
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
E/NotificationService( 456): An error occurred profiling the notification.
E/NotificationService( 456): java.lang.NullPointerException
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationInternal(NotificationManagerService.java:1147)
E/NotificationService( 456): at com.android.server.NotificationManagerService.enqueueNotificationWithTag(NotificationManagerService.java:983)
E/NotificationService( 456): at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:129)
E/NotificationService( 456): at android.os.Binder.execTransact(Binder.java:367)
E/NotificationService( 456): at dalvik.system.NativeStart.run(Native Method)
D/SizeAdaptiveLayout( 539): [email protected] view [email protected] measured out of bounds at 95px clamped to 96px
I found the matching code in http://code.metager.de/source/xref/CyanogenMod/AndroidFrameworksBase/services/java/com/android/server/NotificationManagerService.java. It says:
Code:
synchronized (mNotificationList) {
final boolean inQuietHours = inQuietHours();
NotificationRecord r = new NotificationRecord(pkg, tag, id,
callingUid, callingPid,
priority,
notification);
NotificationRecord old = null;
int index = indexOfNotificationLocked(pkg, tag, id);
if (index < 0) {
mNotificationList.add(r);
} else {
old = mNotificationList.remove(index);
mNotificationList.add(index, r);
// Make sure we don't lose the foreground service state.
if (old != null) {
notification.flags |=
old.notification.flags&Notification.FLAG_FOREGROUND_SERVICE;
}
}
// Ensure if this is a foreground service that the proper additional
// flags are set.
if ((notification.flags&Notification.FLAG_FOREGROUND_SERVICE) != 0) {
notification.flags |= Notification.FLAG_ONGOING_EVENT
| Notification.FLAG_NO_CLEAR;
}
if (notification.icon != 0) {
StatusBarNotification n = new StatusBarNotification(pkg, id, tag,
r.uid, r.initialPid, notification);
n.priority = r.priority;
if (old != null && old.statusBarKey != null) {
r.statusBarKey = old.statusBarKey;
long identity = Binder.clearCallingIdentity();
try {
mStatusBar.updateNotification(r.statusBarKey, n);
}
finally {
Binder.restoreCallingIdentity(identity);
}
} else {
long identity = Binder.clearCallingIdentity();
try {
r.statusBarKey = mStatusBar.addNotification(n);
if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) {
mAttentionLight.pulse();
}
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
sendAccessibilityEvent(notification, pkg);
} else {
Slog.e(TAG, "Ignoring notification with icon==0: " + notification);
if (old != null && old.statusBarKey != null) {
long identity = Binder.clearCallingIdentity();
try {
mStatusBar.removeNotification(old.statusBarKey);
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
}
try {
final ProfileManager profileManager =
(ProfileManager) mContext.getSystemService(Context.PROFILE_SERVICE);
ProfileGroup group = profileManager.getActiveProfileGroup(pkg);
notification = group.processNotification(notification);
} catch(Throwable th) {
Log.e(TAG, "An error occurred profiling the notification.", th);
}
// If we're not supposed to beep, vibrate, etc. then don't.
if (((mDisabledNotifications & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) == 0)
&& (!(old != null
&& (notification.flags & Notification.FLAG_ONLY_ALERT_ONCE) != 0 ))
&& mSystemReady) {
final AudioManager audioManager = (AudioManager) mContext
.getSystemService(Context.AUDIO_SERVICE);
// sound
final boolean useDefaultSound =
(notification.defaults & Notification.DEFAULT_SOUND) != 0;
if (!(inQuietHours && mQuietHoursMute)
&& (useDefaultSound || notification.sound != null)) {
Uri uri;
if (useDefaultSound) {
uri = Settings.System.DEFAULT_NOTIFICATION_URI;
} else {
uri = notification.sound;
}
boolean looping = (notification.flags & Notification.FLAG_INSISTENT) != 0;
int audioStreamType;
if (notification.audioStreamType >= 0) {
audioStreamType = notification.audioStreamType;
} else {
audioStreamType = DEFAULT_STREAM_TYPE;
}
mSoundNotification = r;
// do not play notifications if stream volume is 0
// (typically because ringer mode is silent).
if (audioManager.getStreamVolume(audioStreamType) != 0) {
long identity = Binder.clearCallingIdentity();
try {
mSound.play(mContext, uri, looping, audioStreamType);
}
finally {
Binder.restoreCallingIdentity(identity);
}
}
}
// vibrate
final boolean useDefaultVibrate =
(notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
if (!(inQuietHours && mQuietHoursStill)
&& (useDefaultVibrate || notification.vibrate != null)
&& audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {
mVibrateNotification = r;
mVibrator.vibrate(useDefaultVibrate ? DEFAULT_VIBRATE_PATTERN
: notification.vibrate,
((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
}
}
I installed a new firmware and my backup didn't work. So i thinks this counts as a "full wipe". Anyways, i think the wrong data belongs to "systemui". You can delete all stored data with Titanium backup.
I've had the same error again after a full restore via Titanium backup. This time i deleted all data from "google play services" and it helped.
EDIT: Sorry, it came back again. I'm doing now a full wipe and only restore the data i really need.

[ROOT] Hide/show system bar (rooted)

I got issue with Nexus 10 - 4.2.2. I was testing this on Galaxy Tab 10.1 with 4.0.4 and it was working fine:
try
{
Process proc = Runtime.getRuntime().exec(new String[]{"sh","startservice","-n","com.android.systemui/.SystemUIService"});
proc.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
//REQUIRES ROOT
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 42 s16 com.android.systemui"}); //WAS 79
proc.waitFor();
}
catch(Exception ex)
{
//Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}
Hide and show system bar and keys, but on Nexus 10 just hide and than System UI Service got stack on restarting. Anyone know why?
I found the solution, but don't know how to remove the post :/
Solution:
To show and hide the system bar and notification bar on 4.2.2 and others:
Hide:
try
{
String command;
command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib service call activity 42 s16 com.android.systemui";
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
proc.waitFor();
}
catch(Exception ex)
{
Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_LONG).show();
}
Show:
try
{
String command;
command = "LD_LIBRARY_PATH=/vendor/lib:/system/lib am startservice -n com.android.systemui/.SystemUIService";
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command }, envp);
proc.waitFor();
}
catch (Exception e)
{
e.printStackTrace();
}

[Q] nested if and user variables

Hello
Is it possible to have nested IF in zooper? if so how? nesting "$" signs does not seem to work.
Alternatively, is it possible to create user boolean variables ?
thanks
Julia
papex said:
Hello
Is it possible to have nested IF in zooper? if so how? nesting "$" signs does not seem to work.
Alternatively, is it possible to create user boolean variables ?
thanks
Julia
Click to expand...
Click to collapse
In short: no and no.
There is however a limited way to work around the nesting problem. Instead of nesting your conditionals in a cascading style like this
if (var1 = 0) {
if (var2 > 10) {
A
else {
B
}​} else if (var1 = 1) {
if (var2 > 10) {
C
else {
D
}​}​you have to write it as mutual exclusive conditionals linked by ANDs. So the above example could be written in Zooper like this
$var1 = 0 && var 2 > 10?A$$var1 = 0 && var 2 < 10?B$$var1 = 1 && var 2 > 10?C$$var1 = 0 && var 2 < 10?D$​The more conditionals you want to nest, the more complicate it gets. This is why it's only a limited possibility for something like 2-3 conditions.

GWD loads watchface.xml this way (java source inside)

This is from the GWD file : C:\Program Files (x86)\GearWatchDesigner\plugins\com.samsung.gwd_1.6.2.201810300802.jar
This is a Java package. When looking inside with a "Java decompiler" (free download), find the loadXml.class and you'll see the following code. Once we analyze this, I think we can kind of figure out the schema.
Code:
package com.samsung.gwd;
import com.samsung.gwd.gef.models.ActionConfig;
import com.samsung.gwd.gef.models.ActionConfigEnum.ACTION_STATE;
import com.samsung.gwd.gef.models.Condition;
import com.samsung.gwd.gef.models.ModelAnimation;
import com.samsung.gwd.gef.models.ModelBackground;
import com.samsung.gwd.gef.models.ModelComponent;
import com.samsung.gwd.gef.models.ModelDigitalclock;
import com.samsung.gwd.gef.models.ModelGroup;
import com.samsung.gwd.gef.models.ModelHand;
import com.samsung.gwd.gef.models.ModelImage;
import com.samsung.gwd.gef.models.ModelIndex;
import com.samsung.gwd.gef.models.ModelRoot;
import com.samsung.gwd.gef.models.ModelText;
import com.samsung.gwd.source.Source;
import com.samsung.gwd.ui.dialog.bitmapfont.BitmapFont;
import com.samsung.gwd.utils.RM;
import com.samsung.gwd.utils.Util;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.SAXException;
public class LoadXml
{
public static final int TIME_ONE_MINUTE = 900;
public static final int TIME_ONE_HOUR = 54000;
public static final double PLATFORM_HOUR_MINUTE_CORRECTION = 0.005D;
Project project;
ModelRoot root;
String path;
Document doc;
String projectDir;
int width;
int height;
public LoadXml(String path, String name, Project project)
{
this.path = path;
File file = new File(path + name);
this.project = project;
this.projectDir = project.getProjectDir();
if (file.isFile())
{
DocumentBuilderFactory docBuildFact = DocumentBuilderFactory.newInstance();
try
{
DocumentBuilder docBuild = docBuildFact.newDocumentBuilder();
this.doc = docBuild.parse(file);
this.doc.getDocumentElement().normalize();
NodeList watchface = this.doc.getElementsByTagName("watchface");
Node watchfaceNode = watchface.item(0);
this.width = Integer.parseInt(((Element)watchfaceNode).getAttribute("width"));
this.height = Integer.parseInt(((Element)watchfaceNode).getAttribute("height"));
NodeList groupsList = this.doc.getElementsByTagName("groups");
for (int i = 0; i < groupsList.getLength(); i++)
{
Node groupsNode = groupsList.item(i);
processGroups((Element)groupsNode);
}
}
catch (ParserConfigurationException e)
{
e.printStackTrace();
}
catch (SAXException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
Application.LOGGER.error("Loading XML failed : " + path + name);
}
}
void processGroups(Element groupsElmt)
{
if (groupsElmt.getAttribute("type").equals("ambient"))
{
this.project.initLowBitAmbientMode();
this.root = this.project.getAmbientLowRoot();
}
else if (groupsElmt.getAttribute("type").equals("ambient-fullcolor"))
{
this.project.initHighColorAmbientMode();
this.root = this.project.getAmbientHighRoot();
}
else if (groupsElmt.getAttribute("type").equals("current"))
{
this.root = this.project.getModelRoot();
}
else
{
this.root = this.project.getNormalRoot();
}
NodeList groupList = groupsElmt.getElementsByTagName("group");
for (int j = 0; j < groupList.getLength(); j++)
{
Node groupNode = groupList.item(j);
processGroup((Element)groupNode);
}
}
void processGroup(Element groupElm)
{
ModelGroup group = null;
ActionConfig actionConf = null;
String tmpStr = groupElm.getAttribute("x");
if (!groupElm.getAttribute("name").startsWith("__DEFAULT_GROUP")) {
if (!tmpStr.isEmpty())
{
group = new ModelGroup(this.root);
group.setRect(Integer.parseInt(groupElm.getAttribute("x")), Integer.parseInt(groupElm.getAttribute("y")),
Integer.parseInt(groupElm.getAttribute("width")), Integer.parseInt(groupElm.getAttribute("height")));
}
else
{
group = new ModelGroup(this.root);
group.setRect(0, 0, this.width, this.height);
}
}
Point groupLoc;
Point groupLoc;
if (!groupElm.getAttribute("x").isEmpty()) {
groupLoc = new Point(Integer.parseInt(groupElm.getAttribute("x")), Integer.parseInt(groupElm.getAttribute("y")));
} else {
groupLoc = new Point(0, 0);
}
NodeList groupChildList = groupElm.getChildNodes();
for (int i = 0; i < groupChildList.getLength(); i++)
{
Node childNode = groupChildList.item(i);
if ((childNode.getNodeType() == 1) && (childNode.getNodeName().equals("action")))
{
Element childElm = (Element)childNode;
String on_event = childElm.getAttribute("on_event");
if (on_event.equals("tap"))
{
String type = childElm.getAttribute("type");
if (type.equals("launch"))
{
NodeList launchList = childElm.getElementsByTagName("launch");
if (launchList.getLength() != 0)
{
Node launchNode = launchList.item(0);
String appid = ((Element)launchNode).getAttribute("app_id");
if (appid.isEmpty()) {
appid = ((Element)launchNode).getAttribute("preset");
}
if (actionConf != null) {
break;
}
actionConf = new ActionConfig(DeviceSpec.GEAR_S2.getOpenAppTable());
actionConf.setActionState("Open App");
actionConf.setSelectAppId(appid);
}
}
else if (type.equals("image-set-show-next"))
{
if (actionConf != null) {
break;
}
actionConf = new ActionConfig(DeviceSpec.GEAR_S2.getOpenAppTable());
actionConf.setActionState("Change Image");
}
}
}
}
for (int i = 0; i < groupChildList.getLength(); i++)
{
Node childNode = groupChildList.item(i);
if (childNode.getNodeType() == 1)
{
Element childElmnt = (Element)childNode;
if (childNode.getNodeName().equals("part"))
{
ModelComponent model = processPart(childElmnt, group, actionConf);
if (model != null)
{
model.setLocation(model.getLocation().x + groupLoc.x, model.getLocation().y + groupLoc.y);
try
{
if (actionConf == null) {
break;
}
actionConf.setModel(model);
model.setActionConfig(actionConf);
model.setButton(true);
}
catch (Exception e)
{
e.printStackTrace();
if (group == null)
{
this.root.removeChild(model); continue;
}
group.removeChild(model);
continue;
}
}
}
else if (childNode.getNodeName().equals("condition"))
{
ModelComponent model = processCondition(childElmnt, group, 0, 0, null, actionConf);
if (model != null)
{
model.setLocation(model.getLocation().x + groupLoc.x, model.getLocation().y + groupLoc.y);
try
{
if (group == null) {
this.root.addChild(model);
} else {
group.addChild(model);
}
if (actionConf == null) {
break;
}
actionConf.setModel(model);
model.setActionConfig(actionConf);
model.setButton(true);
}
catch (Exception e)
{
e.printStackTrace();
if (group == null) {
this.root.removeChild(model);
} else {
group.removeChild(model);
}
}
}
}
}
}
}
ModelComponent processPart(Element partElmt, ModelGroup group, ActionConfig actionConf)
{
Rectangle partRect = null;
String tmpStr = partElmt.getAttribute("x");
if (!tmpStr.isEmpty()) {
partRect = new Rectangle(Integer.parseInt(tmpStr),
Integer.parseInt(partElmt.getAttribute("y")),
Integer.parseInt(partElmt.getAttribute("width")),
Integer.parseInt(partElmt.getAttribute("height")));
}
String type = partElmt.getAttribute("type");
if (type.equals("image")) {
return processPartImage(partElmt, group, partRect, actionConf);
}
if (type.equals("text")) {
return processPartText(partElmt, group, partRect);
}
if (!type.equals("draw")) {
Application.LOGGER.error("Not supporeted part type : " + type);
}
return null;
}
ModelComponent processPartImage(Element partElmt, ModelGroup group, Rectangle partRect, ActionConfig actionConf)
{
ModelImage obj = null;
boolean isHands = false;
boolean isBackground = false;
boolean isIndex = false;
ModelComponent parent;
ModelComponent parent;
if (group != null) {
parent = group;
} else {
parent = this.root;
}
NodeList partAttrList = null;
Node partAttrNode = null;
Element partAttrElmnt = null;
Element metaElmnt = null;
partAttrList = partElmt.getElementsByTagName("metadata");
if (partAttrList.getLength() != 0)
{
for (int i = 0; i < partAttrList.getLength(); i++)
{
partAttrNode = partAttrList.item(i);
metaElmnt = (Element)partAttrNode;
String tmpStr = metaElmnt.getAttribute("type");
if (tmpStr.equals("hands")) {
isHands = true;
} else if (tmpStr.equals("background")) {
isBackground = true;
} else if (tmpStr.equals("index")) {
isIndex = true;
}
}
}
else
{
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
if ((partAttrElmnt.getAttribute("source").equals("hour0-23.minute")) ||
(partAttrElmnt.getAttribute("source").equals("minute"))) {
isHands = true;
}
}
}
partAttrList = partElmt.getElementsByTagName("image-set");
if ((partAttrList.getLength() == 0) || ((actionConf != null) && (actionConf.getActionState() == ActionConfigEnum.ACTION_STATE.CHANGE_IMAGE)))
{
String baseName = null;
if ((actionConf != null) && (actionConf.getActionState() == ActionConfigEnum.ACTION_STATE.CHANGE_IMAGE))
{
String projResDir = new String(this.project.getProjectDir() + BuildConfig.PATH_XML);
partAttrList = partElmt.getElementsByTagName("image-set");
if (partAttrList.getLength() != 0)
{
int changeNum = 0;
NodeList imageSetChildList = partAttrList.item(0).getChildNodes();
for (int nodeIndex = 0; nodeIndex < imageSetChildList.getLength(); nodeIndex++)
{
Node imageSetChildNode = imageSetChildList.item(nodeIndex);
if (imageSetChildNode.getNodeType() == 1) {
if (imageSetChildNode.getNodeName().equals("image"))
{
Element imageElmnt = (Element)imageSetChildNode;
if (nodeIndex == 0)
{
baseName = imageElmnt.getTextContent();
}
else
{
if ((imageElmnt.getTextContent() == "") || (imageElmnt.getTextContent().compareTo(baseName) == 0))
{
actionConf.setChangeImage(null, changeNum, null);
}
else
{
String str_des = new String(imageElmnt.getTextContent());
if (System.getProperty("os.name").contains("Windows")) {
while (str_des.contains("/")) {
str_des = str_des.replace("/", File.separator);
}
}
actionConf.setChangeImage(RM.getImage(projResDir + str_des),
changeNum, projResDir + str_des);
}
changeNum++;
}
}
}
}
}
Rectangle tempRect = new Rectangle(partRect);
if (isHands) {
obj = new ModelHand(parent, this.path, baseName);
} else if (isBackground) {
obj = new ModelBackground(parent, this.path, baseName);
} else {
obj = new ModelImage(parent, this.path, baseName);
}
obj.setRect(tempRect);
}
else
{
partAttrList = partElmt.getElementsByTagName("image");
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
NodeList partAttrChildList = partAttrNode.getChildNodes();
Rectangle tempRect = new Rectangle(partRect);
if (partAttrChildList.getLength() == 1)
{
if (isHands)
{
obj = new ModelHand(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
else if (isBackground)
{
obj = new ModelBackground(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
else if (isIndex)
{
String tmpStr = metaElmnt.getAttribute("image");
if (!tmpStr.isEmpty())
{
obj = new ModelIndex(parent, this.path, tmpStr);
obj.setRect(tempRect);
((ModelIndex)obj).setOriginalRect(new Rectangle(Integer.parseInt(metaElmnt.getAttribute("x")),
Integer.parseInt(metaElmnt.getAttribute("y")),
Integer.parseInt(metaElmnt.getAttribute("width")),
Integer.parseInt(metaElmnt.getAttribute("height"))));
}
else
{
obj = new ModelIndex(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
tmpStr = metaElmnt.getAttribute("range");
if (tmpStr.isEmpty()) {
return null;
}
((ModelIndex)obj).setRange(0.0D, Integer.parseInt(tmpStr));
tmpStr = metaElmnt.getAttribute("number");
((ModelIndex)obj).setNumber(Integer.parseInt(tmpStr));
((ModelIndex)obj).apply();
((ModelIndex)obj).setRect(tempRect);
}
else
{
obj = new ModelImage(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
}
else {
Application.LOGGER.error("LoadXml : Implement me - image condition, length=" + partAttrChildList.getLength());
}
}
if (obj != null)
{
partAttrList = partElmt.getElementsByTagName("color");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String tmpStr = partAttrElmnt.getAttribute("a");
if (!tmpStr.isEmpty())
{
tmpStr = partAttrElmnt.getAttribute("r");
if (!tmpStr.isEmpty())
{
obj.setFilterEnable(true);
float[] hsl = Color.RGBtoHSB(Integer.parseInt(partAttrElmnt.getAttribute("r")),
Integer.parseInt(partAttrElmnt.getAttribute("g")),
Integer.parseInt(partAttrElmnt.getAttribute("b")), null);
obj.setHue((int)(hsl[0] * 360.0F - 180.0F));
obj.setSaturation((int)(hsl[1] * 200.0F - 100.0F));
obj.setLightness((int)(hsl[2] * 200.0F - 100.0F));
obj.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
else
{
obj.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
}
}
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String source = partAttrElmnt.getAttribute("source");
if (!source.isEmpty())
{
if (isHands)
{
ModelHand hand = (ModelHand)obj;
hand.setSource(Source.findById(source));
if (!partElmt.getAttribute("x").isEmpty())
{
hand.setPivot(Integer.parseInt(partAttrElmnt.getAttribute("center_x")) +
Integer.parseInt(partElmt.getAttribute("x")),
Integer.parseInt(partAttrElmnt.getAttribute("center_y")) +
Integer.parseInt(partElmt.getAttribute("y")));
hand.setStartAngle(Double.parseDouble(partAttrElmnt.getAttribute("start_angle")));
hand.setEndAngle(Double.parseDouble(partAttrElmnt.getAttribute("end_angle")));
hand.setStartValue(Double.parseDouble(partAttrElmnt.getAttribute("start_value")));
hand.setEndValue(Double.parseDouble(partAttrElmnt.getAttribute("end_value")));
}
else
{
if (group == null) {
hand.setPivot(Integer.parseInt(partAttrElmnt.getAttribute("center_x")),
Integer.parseInt(partAttrElmnt.getAttribute("center_y")));
}
hand.setStartAngle(Double.parseDouble(partAttrElmnt.getAttribute("start_angle")));
hand.setEndAngle(Double.parseDouble(partAttrElmnt.getAttribute("end_angle")));
hand.setStartValue(Double.parseDouble(partAttrElmnt.getAttribute("start_value")));
hand.setEndValue(Double.parseDouble(partAttrElmnt.getAttribute("end_value")));
}
if (partAttrElmnt.getAttribute("animation").equals("tick"))
{
hand.setTensionFrame(Integer.parseInt(partAttrElmnt.getAttribute("tick_frame")) / 2);
hand.setTensionAngle(Double.parseDouble(partAttrElmnt.getAttribute("tick_angle")));
hand.setTension((int)(hand.getTensionAngle() * 100.0D / 6.0D));
hand.setTensionEnabled(true);
}
if (source.equals("hour0-11.minute"))
{
hand.setSource(Source.findById("hour0-23.minute"));
if (hand.getStartAngle() < hand.getEndAngle()) {
hand.setEndAngle(hand.getEndAngle() + 360.0D);
} else {
hand.setEndAngle(hand.getEndAngle() - 360.0D);
}
}
}
}
else if (!partAttrElmnt.getAttribute("angle").isEmpty()) {
if (Util.checkExprTag(partAttrElmnt.getAttribute("angle"))) {
obj.setAngle(Util.removeExprTag(partAttrElmnt.getAttribute("angle")));
} else {
obj.setAngle(Double.parseDouble(partAttrElmnt.getAttribute("angle")));
}
}
}
}
}
else
{
partAttrList = partElmt.getElementsByTagName("image-set");
if (partAttrList.getLength() != 0)
{
ModelAnimation ani = new ModelAnimation(parent);
int frameNum = 0;
ani.setRect(partRect);
NodeList imageSetChildList = partAttrList.item(0).getChildNodes();
for (int nodeIndex = 0; nodeIndex < imageSetChildList.getLength(); nodeIndex++)
{
Node imageSetChildNode = imageSetChildList.item(nodeIndex);
if (imageSetChildNode.getNodeType() == 1)
{
if (imageSetChildNode.getNodeName().equals("image"))
{
Element imageElmnt = (Element)imageSetChildNode;
ModelImage frameItem = new ModelImage(ani, this.path, imageElmnt.getTextContent());
frameItem.setRect(0, 0, partRect.width, partRect.height);
frameItem.setId("Frame " + (nodeIndex + 1));
frameItem.getCondition().deleteAll();
frameItem.getCondition().addItem(frameNum, frameNum + 1);
}
frameNum++;
}
}
partAttrList = partElmt.getElementsByTagName("color");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String tmpStr = partAttrElmnt.getAttribute("a");
if (!tmpStr.isEmpty()) {
ani.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
}
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrElmnt = (Element)partAttrList.item(0);
if (!partAttrElmnt.getAttribute("angle").isEmpty()) {
if (Util.checkExprTag(partAttrElmnt.getAttribute("angle"))) {
ani.setAngle(Util.removeExprTag(partAttrElmnt.getAttribute("angle")));
} else {
ani.setAngle(Double.parseDouble(partAttrElmnt.getAttribute("angle")));
}
}
}
return ani;
}
}
return obj;
}
Con't
Code:
ModelComponent processPartText(Element partElmt, ModelGroup group, Rectangle partRect)
{
String tmpStr = null;
boolean isDigitalclock = false;
NodeList partAttrList = null;
Node partAttrNode = null;
Element partAttrElmnt = null;
partAttrList = partElmt.getElementsByTagName("metadata");
if (partAttrList.getLength() != 0) {
for (int i = 0; i < partAttrList.getLength(); i++)
{
partAttrNode = partAttrList.item(i);
partAttrElmnt = (Element)partAttrNode;
tmpStr = partAttrElmnt.getAttribute("type");
if (tmpStr.equals("digitalclock")) {
isDigitalclock = true;
}
}
}
Rectangle tempRect = new Rectangle(partRect);
if (group != null)
{
tempRect.x += group.getRect().x;
tempRect.y += group.getRect().y;
}
ModelComponent parent;
ModelComponent parent;
if (group != null) {
parent = group;
} else {
parent = this.root;
}
ModelText mText;
ModelText mText;
if (isDigitalclock) {
mText = new ModelDigitalclock(parent);
} else {
mText = new ModelText(parent);
}
mText.setRect(partRect);
partAttrList = partElmt.getElementsByTagName("style");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
tmpStr = partAttrElmnt.getAttribute("typeface");
if (!tmpStr.isEmpty()) {
mText.setFontName(tmpStr);
}
tmpStr = partAttrElmnt.getAttribute("size");
mText.setFont(mText.getFontName(), Integer.parseInt(tmpStr));
tmpStr = partAttrElmnt.getAttribute("style");
if (!tmpStr.isEmpty())
{
if (tmpStr.equals("Bold")) {
mText.setFontStyle(1);
}
mText.setFontStyle(mText.getFontStyle());
}
tmpStr = partAttrElmnt.getAttribute("filename");
if (!tmpStr.isEmpty())
{
mText.setFontName(tmpStr);
mText.setCustomFont(tmpStr, mText.getFontSize());
}
}
partAttrList = partElmt.getElementsByTagName("color");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
tmpStr = partAttrElmnt.getAttribute("r");
if (!tmpStr.isEmpty())
{
mText.setColor(RM.getColor(Integer.parseInt(partAttrElmnt.getAttribute("r")),
Integer.parseInt(partAttrElmnt.getAttribute("g")),
Integer.parseInt(partAttrElmnt.getAttribute("b"))));
mText.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
else
{
tmpStr = partAttrElmnt.getAttribute("a");
if (!tmpStr.isEmpty()) {
mText.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
}
}
partAttrList = partElmt.getElementsByTagName("icu-skeleton");
int j;
Locale[] pcLocales;
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
mText.setText(partAttrElmnt.getTextContent());
String strLocales = partAttrElmnt.getAttribute("locale");
if (!strLocales.isEmpty())
{
String[] tokens = strLocales.split(";");
List<Locale> locales = new ArrayList();
String[] arrayOfString1;
j = (arrayOfString1 = tokens).length;
for (int i = 0; i < j; i++)
{
String token = arrayOfString1[i];
pcLocales = Locale.getAvailableLocales();
for (int i = 0; i < pcLocales.length; i++)
{
String str = pcLocales[i].getLanguage() + "_" + pcLocales[i].getCountry();
if (token.equals(str))
{
locales.add(pcLocales[i]);
break;
}
}
}
mText.setLocale(locales);
}
}
partAttrList = partElmt.getElementsByTagName("text");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String strAlign = partAttrElmnt.getAttribute("align");
if (!strAlign.isEmpty()) {
if (strAlign.equals("left")) {
mText.setAlignment(16384);
} else if (strAlign.equals("right")) {
mText.setAlignment(131072);
} else {
mText.setAlignment(16777216);
}
}
String strLocales = partAttrElmnt.getAttribute("locale");
if (!strLocales.isEmpty())
{
String[] tokens = strLocales.split(";");
List<Locale> locales = new ArrayList();
int k = (pcLocales = tokens).length;
for (j = 0; j < k; j++)
{
Object token = pcLocales[j];
Locale[] pcLocales = Locale.getAvailableLocales();
for (int i = 0; i < pcLocales.length; i++)
{
String str = pcLocales[i].getLanguage() + "_" + pcLocales[i].getCountry();
if (((String)token).equals(str))
{
locales.add(pcLocales[i]);
break;
}
}
}
mText.setLocale(locales);
}
if (partAttrElmnt.getElementsByTagName("format").getLength() != 0)
{
String front = null;String source = null;String back = null;
NodeList textChildList = partAttrElmnt.getChildNodes();
for (int i = 0; i < 2; i++)
{
Node textChildNode = textChildList.item(0);
if (textChildNode.getNodeType() == 1)
{
Element textChildElmnt = (Element)textChildNode;
if (textChildElmnt.getTagName().equals("format")) {
break;
}
textChildList = textChildElmnt.getChildNodes();
}
}
boolean isFormatProcessed = false;
for (int i = 0; i < textChildList.getLength(); i++)
{
Node textChildNode = textChildList.item(i);
if (textChildNode.getNodeType() == 1)
{
Element textChildElmnt = (Element)textChildNode;
if (textChildElmnt.getTagName().equals("format"))
{
source = textChildElmnt.getAttribute("source");
isFormatProcessed = true;
}
}
else if (textChildNode.getNodeType() == 3)
{
Text textChildElmnt = (Text)textChildNode;
tmpStr = textChildElmnt.getTextContent();
if (!tmpStr.isEmpty()) {
if (!isFormatProcessed) {
front = tmpStr;
} else {
back = tmpStr;
}
}
}
}
Application.LOGGER.info(String.format("contents = %s, %s, %s", new Object[] { front, source, back }));
mText.setSource(Source.findById(source));
mText.setFormat(front, back);
}
else
{
tmpStr = partAttrElmnt.getTextContent();
Application.LOGGER.info("contents = " + tmpStr);
if ((!isDigitalclock) &&
(!tmpStr.isEmpty())) {
mText.setText(tmpStr);
}
}
}
partAttrList = partElmt.getElementsByTagName("font");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
tmpStr = partAttrElmnt.getAttribute("filename");
if (!tmpStr.isEmpty()) {
mText.setCustomFont(partAttrElmnt.getAttribute("filename"), Integer.parseInt(partAttrElmnt.getAttribute("size")));
}
tmpStr = partAttrElmnt.getAttribute("family");
if (!tmpStr.isEmpty())
{
NodeList bitmapFontsList = this.doc.getElementsByTagName("bitmap-fonts");
if (bitmapFontsList.getLength() != 0)
{
Node bitmapFontsNode = bitmapFontsList.item(0);
NodeList bitmapFontList = bitmapFontsNode.getChildNodes();
for (int item = 0; item < bitmapFontList.getLength(); item++)
{
Node bitmapFontNode = bitmapFontList.item(item);
if (bitmapFontNode.getNodeType() == 1)
{
Element fontElmt = (Element)bitmapFontNode;
String fontName = fontElmt.getAttribute("name");
if (fontName.equals(tmpStr))
{
processBitmapFonts((Element)bitmapFontNode, mText);
break;
}
}
}
}
}
tmpStr = partAttrElmnt.getAttribute("slant");
if ((!tmpStr.isEmpty()) &&
(tmpStr.equals("italic"))) {
mText.addFontStyle(2);
}
tmpStr = partAttrElmnt.getAttribute("weight");
if ((!tmpStr.isEmpty()) &&
(tmpStr.equals("bold"))) {
mText.addFontStyle(1);
}
}
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String source = partAttrElmnt.getAttribute("source");
if (!source.isEmpty()) {
mText.setSource(Source.findById(source));
} else if (!partAttrElmnt.getAttribute("angle").isEmpty()) {
if (Util.checkExprTag(partAttrElmnt.getAttribute("angle"))) {
mText.setAngle(Util.removeExprTag(partAttrElmnt.getAttribute("angle")));
} else {
mText.setAngle(Double.parseDouble(partAttrElmnt.getAttribute("angle")));
}
}
}
partAttrList = partElmt.getElementsByTagName("underline");
if (partAttrList.getLength() != 0) {
mText.addFontStyle(4);
}
partAttrList = partElmt.getElementsByTagName("strike-through");
if (partAttrList.getLength() != 0) {
mText.addFontStyle(8);
}
mText.setFontStyle(mText.getFontStyle());
return mText;
}
ModelComponent processCondition(Element conditionElmt, ModelGroup group, int start, int end, ModelComponent _obj, ActionConfig actionConf)
{
ModelComponent conditionObj = _obj;
int depth = 0;
int startValue = 0;
String source = conditionElmt.getAttribute("source");
if (source.equals("battery.percent"))
{
NodeList conditionChildList = conditionElmt.getChildNodes();
for (int i = 0; i < conditionChildList.getLength(); i++)
{
Node conditionChildNode = conditionChildList.item(i);
if (conditionChildNode.getNodeType() == 1)
{
Element conditionChildElmnt = (Element)conditionChildNode;
if (conditionChildNode.getNodeName().equals("compare"))
{
String compareValue = conditionChildElmnt.getAttribute("lt");
if (compareValue.isEmpty()) {
compareValue = conditionChildElmnt.getAttribute("le");
}
int value = Integer.parseInt(compareValue);
ModelComponent obj = processCompareBattery(conditionChildElmnt, group, start + startValue, value, conditionObj, actionConf);
if ((obj != null) && (conditionObj == null)) {
conditionObj = obj;
} else {
startValue = value;
}
}
else
{
conditionChildNode.getNodeName().equals("default");
}
}
}
}
else if (source.equals("pedometer.stepPercent"))
{
NodeList conditionChildList = conditionElmt.getChildNodes();
for (int i = 0; i < conditionChildList.getLength(); i++)
{
Node conditionChildNode = conditionChildList.item(i);
if (conditionChildNode.getNodeType() == 1)
{
Element conditionChildElmnt = (Element)conditionChildNode;
if (conditionChildNode.getNodeName().equals("compare"))
{
String compareValue = conditionChildElmnt.getAttribute("lt");
if (compareValue.isEmpty()) {
compareValue = conditionChildElmnt.getAttribute("le");
}
if (!compareValue.isEmpty())
{
int value = Integer.parseInt(compareValue);
ModelComponent obj = processComparePedometer(conditionChildElmnt, group, start + startValue, value, conditionObj, actionConf);
if ((obj != null) && (conditionObj == null)) {
conditionObj = obj;
} else {
startValue = value;
}
}
}
else
{
conditionChildNode.getNodeName().equals("default");
}
}
}
}
else
{
if (source.equals("hour0-23.minute"))
{
depth = 1;
}
else if (source.equals("second.millisecond"))
{
depth = 2;
startValue = start;
}
NodeList conditionChildList = conditionElmt.getChildNodes();
for (int i = 0; i < conditionChildList.getLength(); i++)
{
Node conditionChildNode = conditionChildList.item(i);
if (conditionChildNode.getNodeType() == 1)
{
Element conditionChildElmnt = (Element)conditionChildNode;
if (conditionChildNode.getNodeName().equals("compare"))
{
String compareValue = conditionChildElmnt.getAttribute("lt");
if (!compareValue.isEmpty()) {
if (depth == 1)
{
int value = (int)Math.round((Double.parseDouble(compareValue) + 0.005D) * 54000.0D);
if (value % 900 != 0) {
value = (int)Math.round(Double.parseDouble(compareValue) * 54000.0D);
}
ModelComponent obj = processCompareTimeline(conditionChildElmnt, group, start + startValue, value, conditionObj, actionConf);
if ((obj != null) && (conditionObj == null)) {
conditionObj = obj;
} else {
startValue = value;
}
}
else
{
int value = (int)Math.round(Double.parseDouble(compareValue) * 15.0D) + start;
ModelComponent obj = processCompareTimeline(conditionChildElmnt, group, startValue, value, conditionObj, actionConf);
if ((obj != null) && (conditionObj == null)) {
conditionObj = obj;
} else {
startValue = value;
}
}
}
}
else if ((conditionChildNode.getNodeName().equals("default")) &&
(depth == 2))
{
ModelComponent obj = processCompareTimeline(conditionChildElmnt, group, startValue, end, conditionObj, actionConf);
if ((obj != null) && (conditionObj == null)) {
conditionObj = obj;
} else {
startValue = end;
}
}
}
}
}
return conditionObj;
}
ModelComponent processCompareTimeline(Element compareElmt, ModelGroup group, int start, int end, ModelComponent _obj, ActionConfig actionConf)
{
ModelComponent conditionObj = _obj;
int startValue = start;
int endValue = end;
NodeList compareChildList = compareElmt.getChildNodes();
if (compareChildList.getLength() == 0) {
return null;
}
for (int i = 0; i < compareChildList.getLength(); i++)
{
Node compareChildNode = compareChildList.item(i);
if (compareChildNode.getNodeType() == 1)
{
Element compareChildElmnt = (Element)compareChildNode;
if (compareChildNode.getNodeName().equals("part"))
{
ModelComponent obj = processPart(compareChildElmnt, group, actionConf);
if (obj != null)
{
endValue = end;
if (_obj == null)
{
conditionObj = obj;
conditionObj.getCondition().deleteAll();
conditionObj.getCondition().addItem(startValue, endValue);
}
else
{
conditionObj.getCondition().addItem(startValue, endValue);
}
}
else
{
startValue = end;
}
return obj;
}
if (compareChildNode.getNodeName().equals("condition"))
{
ModelComponent obj = processCondition(compareChildElmnt, group, endValue - 900, endValue, conditionObj, actionConf);
return obj;
}
}
}
return null;
}
ModelComponent processCompareBattery(Element compareElmt, ModelGroup group, int start, int end, ModelComponent _obj, ActionConfig actionConf)
{
ModelComponent conditionObj = _obj;
int startValue = start;
int endValue = end;
NodeList compareChildList = compareElmt.getChildNodes();
if (compareChildList.getLength() == 0) {
return null;
}
for (int i = 0; i < compareChildList.getLength(); i++)
{
Node compareChildNode = compareChildList.item(i);
if (compareChildNode.getNodeType() == 1)
{
Element compareChildElmnt = (Element)compareChildNode;
if (compareChildNode.getNodeName().equals("part"))
{
ModelComponent obj = processPart(compareChildElmnt, group, actionConf);
if (obj != null)
{
endValue = end;
if (conditionObj == null)
{
conditionObj = obj;
conditionObj.getCondition().setSource("battery");
conditionObj.getCondition().deleteAll();
conditionObj.getCondition().addItem(startValue, endValue);
}
else
{
conditionObj.getCondition().addItem(startValue, endValue);
}
}
else
{
startValue = end;
}
return conditionObj;
}
}
}
return null;
}
void processBitmapFonts(Element bitmapElmt, ModelText txt)
{
NodeList bitmapChildList = bitmapElmt.getChildNodes();
if (bitmapChildList.getLength() == 0) {
return;
}
txt.loadBitmapFont(bitmapElmt.getAttribute("name"));
for (int item = 0; item < bitmapChildList.getLength(); item++)
{
Node bitmapChildNode = bitmapChildList.item(item);
if (bitmapChildNode.getNodeType() == 1)
{
Element bitmapChildElmnt = (Element)bitmapChildNode;
if (bitmapChildNode.getNodeName().equals("character"))
{
String name = bitmapChildElmnt.getAttribute("name");
txt.getBitmapFont().setCharacter(name,
RM.getImage(this.projectDir + BuildConfig.PATH_CUSTOM_FONT + name + '/' + bitmapChildElmnt.getAttribute("filepath")));
}
}
}
}
ModelComponent processComparePedometer(Element compareElmt, ModelGroup group, int start, int end, ModelComponent _obj, ActionConfig actionConf)
{
ModelComponent conditionObj = _obj;
int startValue = start;
int endValue = end;
NodeList compareChildList = compareElmt.getChildNodes();
if (compareChildList.getLength() == 0) {
return null;
}
for (int i = 0; i < compareChildList.getLength(); i++)
{
Node compareChildNode = compareChildList.item(i);
if (compareChildNode.getNodeType() == 1)
{
Element compareChildElmnt = (Element)compareChildNode;
if (compareChildNode.getNodeName().equals("part"))
{
ModelComponent obj = processPart(compareChildElmnt, group, actionConf);
if (obj != null)
{
endValue = end;
if (conditionObj == null)
{
conditionObj = obj;
conditionObj.getCondition().setSource("workout");
conditionObj.getCondition().deleteAll();
conditionObj.getCondition().addItem(startValue, endValue);
}
else
{
conditionObj.getCondition().addItem(startValue, endValue);
}
}
else
{
startValue = end;
}
return conditionObj;
}
}
}
return null;
}
public int getWidth()
{
return this.width;
}
public int getHeight()
{
return this.height;
}
}
Why such complicated? just download the gwd file and convert to tpk file to upload to your smartwatch. I can teach you how to do if you interest to know it. Ping me at [email protected]
Zeuserx said:
This is from the GWD file : C:\Program Files (x86)\GearWatchDesigner\plugins\com.samsung.gwd_1.6.2.201810300802.jar
This is a Java package. When looking inside with a "Java decompiler" (free download), find the loadXml.class and you'll see the following code. Once we analyze this, I think we can kind of figure out the schema.
Code:
package com.samsung.gwd;
import com.samsung.gwd.gef.models.ActionConfig;
import com.samsung.gwd.gef.models.ActionConfigEnum.ACTION_STATE;
import com.samsung.gwd.gef.models.Condition;
import com.samsung.gwd.gef.models.ModelAnimation;
import com.samsung.gwd.gef.models.ModelBackground;
import com.samsung.gwd.gef.models.ModelComponent;
import com.samsung.gwd.gef.models.ModelDigitalclock;
import com.samsung.gwd.gef.models.ModelGroup;
import com.samsung.gwd.gef.models.ModelHand;
import com.samsung.gwd.gef.models.ModelImage;
import com.samsung.gwd.gef.models.ModelIndex;
import com.samsung.gwd.gef.models.ModelRoot;
import com.samsung.gwd.gef.models.ModelText;
import com.samsung.gwd.source.Source;
import com.samsung.gwd.ui.dialog.bitmapfont.BitmapFont;
import com.samsung.gwd.utils.RM;
import com.samsung.gwd.utils.Util;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.SAXException;
public class LoadXml
{
public static final int TIME_ONE_MINUTE = 900;
public static final int TIME_ONE_HOUR = 54000;
public static final double PLATFORM_HOUR_MINUTE_CORRECTION = 0.005D;
Project project;
ModelRoot root;
String path;
Document doc;
String projectDir;
int width;
int height;
public LoadXml(String path, String name, Project project)
{
this.path = path;
File file = new File(path + name);
this.project = project;
this.projectDir = project.getProjectDir();
if (file.isFile())
{
DocumentBuilderFactory docBuildFact = DocumentBuilderFactory.newInstance();
try
{
DocumentBuilder docBuild = docBuildFact.newDocumentBuilder();
this.doc = docBuild.parse(file);
this.doc.getDocumentElement().normalize();
NodeList watchface = this.doc.getElementsByTagName("watchface");
Node watchfaceNode = watchface.item(0);
this.width = Integer.parseInt(((Element)watchfaceNode).getAttribute("width"));
this.height = Integer.parseInt(((Element)watchfaceNode).getAttribute("height"));
NodeList groupsList = this.doc.getElementsByTagName("groups");
for (int i = 0; i < groupsList.getLength(); i++)
{
Node groupsNode = groupsList.item(i);
processGroups((Element)groupsNode);
}
}
catch (ParserConfigurationException e)
{
e.printStackTrace();
}
catch (SAXException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
Application.LOGGER.error("Loading XML failed : " + path + name);
}
}
void processGroups(Element groupsElmt)
{
if (groupsElmt.getAttribute("type").equals("ambient"))
{
this.project.initLowBitAmbientMode();
this.root = this.project.getAmbientLowRoot();
}
else if (groupsElmt.getAttribute("type").equals("ambient-fullcolor"))
{
this.project.initHighColorAmbientMode();
this.root = this.project.getAmbientHighRoot();
}
else if (groupsElmt.getAttribute("type").equals("current"))
{
this.root = this.project.getModelRoot();
}
else
{
this.root = this.project.getNormalRoot();
}
NodeList groupList = groupsElmt.getElementsByTagName("group");
for (int j = 0; j < groupList.getLength(); j++)
{
Node groupNode = groupList.item(j);
processGroup((Element)groupNode);
}
}
void processGroup(Element groupElm)
{
ModelGroup group = null;
ActionConfig actionConf = null;
String tmpStr = groupElm.getAttribute("x");
if (!groupElm.getAttribute("name").startsWith("__DEFAULT_GROUP")) {
if (!tmpStr.isEmpty())
{
group = new ModelGroup(this.root);
group.setRect(Integer.parseInt(groupElm.getAttribute("x")), Integer.parseInt(groupElm.getAttribute("y")),
Integer.parseInt(groupElm.getAttribute("width")), Integer.parseInt(groupElm.getAttribute("height")));
}
else
{
group = new ModelGroup(this.root);
group.setRect(0, 0, this.width, this.height);
}
}
Point groupLoc;
Point groupLoc;
if (!groupElm.getAttribute("x").isEmpty()) {
groupLoc = new Point(Integer.parseInt(groupElm.getAttribute("x")), Integer.parseInt(groupElm.getAttribute("y")));
} else {
groupLoc = new Point(0, 0);
}
NodeList groupChildList = groupElm.getChildNodes();
for (int i = 0; i < groupChildList.getLength(); i++)
{
Node childNode = groupChildList.item(i);
if ((childNode.getNodeType() == 1) && (childNode.getNodeName().equals("action")))
{
Element childElm = (Element)childNode;
String on_event = childElm.getAttribute("on_event");
if (on_event.equals("tap"))
{
String type = childElm.getAttribute("type");
if (type.equals("launch"))
{
NodeList launchList = childElm.getElementsByTagName("launch");
if (launchList.getLength() != 0)
{
Node launchNode = launchList.item(0);
String appid = ((Element)launchNode).getAttribute("app_id");
if (appid.isEmpty()) {
appid = ((Element)launchNode).getAttribute("preset");
}
if (actionConf != null) {
break;
}
actionConf = new ActionConfig(DeviceSpec.GEAR_S2.getOpenAppTable());
actionConf.setActionState("Open App");
actionConf.setSelectAppId(appid);
}
}
else if (type.equals("image-set-show-next"))
{
if (actionConf != null) {
break;
}
actionConf = new ActionConfig(DeviceSpec.GEAR_S2.getOpenAppTable());
actionConf.setActionState("Change Image");
}
}
}
}
for (int i = 0; i < groupChildList.getLength(); i++)
{
Node childNode = groupChildList.item(i);
if (childNode.getNodeType() == 1)
{
Element childElmnt = (Element)childNode;
if (childNode.getNodeName().equals("part"))
{
ModelComponent model = processPart(childElmnt, group, actionConf);
if (model != null)
{
model.setLocation(model.getLocation().x + groupLoc.x, model.getLocation().y + groupLoc.y);
try
{
if (actionConf == null) {
break;
}
actionConf.setModel(model);
model.setActionConfig(actionConf);
model.setButton(true);
}
catch (Exception e)
{
e.printStackTrace();
if (group == null)
{
this.root.removeChild(model); continue;
}
group.removeChild(model);
continue;
}
}
}
else if (childNode.getNodeName().equals("condition"))
{
ModelComponent model = processCondition(childElmnt, group, 0, 0, null, actionConf);
if (model != null)
{
model.setLocation(model.getLocation().x + groupLoc.x, model.getLocation().y + groupLoc.y);
try
{
if (group == null) {
this.root.addChild(model);
} else {
group.addChild(model);
}
if (actionConf == null) {
break;
}
actionConf.setModel(model);
model.setActionConfig(actionConf);
model.setButton(true);
}
catch (Exception e)
{
e.printStackTrace();
if (group == null) {
this.root.removeChild(model);
} else {
group.removeChild(model);
}
}
}
}
}
}
}
ModelComponent processPart(Element partElmt, ModelGroup group, ActionConfig actionConf)
{
Rectangle partRect = null;
String tmpStr = partElmt.getAttribute("x");
if (!tmpStr.isEmpty()) {
partRect = new Rectangle(Integer.parseInt(tmpStr),
Integer.parseInt(partElmt.getAttribute("y")),
Integer.parseInt(partElmt.getAttribute("width")),
Integer.parseInt(partElmt.getAttribute("height")));
}
String type = partElmt.getAttribute("type");
if (type.equals("image")) {
return processPartImage(partElmt, group, partRect, actionConf);
}
if (type.equals("text")) {
return processPartText(partElmt, group, partRect);
}
if (!type.equals("draw")) {
Application.LOGGER.error("Not supporeted part type : " + type);
}
return null;
}
ModelComponent processPartImage(Element partElmt, ModelGroup group, Rectangle partRect, ActionConfig actionConf)
{
ModelImage obj = null;
boolean isHands = false;
boolean isBackground = false;
boolean isIndex = false;
ModelComponent parent;
ModelComponent parent;
if (group != null) {
parent = group;
} else {
parent = this.root;
}
NodeList partAttrList = null;
Node partAttrNode = null;
Element partAttrElmnt = null;
Element metaElmnt = null;
partAttrList = partElmt.getElementsByTagName("metadata");
if (partAttrList.getLength() != 0)
{
for (int i = 0; i < partAttrList.getLength(); i++)
{
partAttrNode = partAttrList.item(i);
metaElmnt = (Element)partAttrNode;
String tmpStr = metaElmnt.getAttribute("type");
if (tmpStr.equals("hands")) {
isHands = true;
} else if (tmpStr.equals("background")) {
isBackground = true;
} else if (tmpStr.equals("index")) {
isIndex = true;
}
}
}
else
{
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
if ((partAttrElmnt.getAttribute("source").equals("hour0-23.minute")) ||
(partAttrElmnt.getAttribute("source").equals("minute"))) {
isHands = true;
}
}
}
partAttrList = partElmt.getElementsByTagName("image-set");
if ((partAttrList.getLength() == 0) || ((actionConf != null) && (actionConf.getActionState() == ActionConfigEnum.ACTION_STATE.CHANGE_IMAGE)))
{
String baseName = null;
if ((actionConf != null) && (actionConf.getActionState() == ActionConfigEnum.ACTION_STATE.CHANGE_IMAGE))
{
String projResDir = new String(this.project.getProjectDir() + BuildConfig.PATH_XML);
partAttrList = partElmt.getElementsByTagName("image-set");
if (partAttrList.getLength() != 0)
{
int changeNum = 0;
NodeList imageSetChildList = partAttrList.item(0).getChildNodes();
for (int nodeIndex = 0; nodeIndex < imageSetChildList.getLength(); nodeIndex++)
{
Node imageSetChildNode = imageSetChildList.item(nodeIndex);
if (imageSetChildNode.getNodeType() == 1) {
if (imageSetChildNode.getNodeName().equals("image"))
{
Element imageElmnt = (Element)imageSetChildNode;
if (nodeIndex == 0)
{
baseName = imageElmnt.getTextContent();
}
else
{
if ((imageElmnt.getTextContent() == "") || (imageElmnt.getTextContent().compareTo(baseName) == 0))
{
actionConf.setChangeImage(null, changeNum, null);
}
else
{
String str_des = new String(imageElmnt.getTextContent());
if (System.getProperty("os.name").contains("Windows")) {
while (str_des.contains("/")) {
str_des = str_des.replace("/", File.separator);
}
}
actionConf.setChangeImage(RM.getImage(projResDir + str_des),
changeNum, projResDir + str_des);
}
changeNum++;
}
}
}
}
}
Rectangle tempRect = new Rectangle(partRect);
if (isHands) {
obj = new ModelHand(parent, this.path, baseName);
} else if (isBackground) {
obj = new ModelBackground(parent, this.path, baseName);
} else {
obj = new ModelImage(parent, this.path, baseName);
}
obj.setRect(tempRect);
}
else
{
partAttrList = partElmt.getElementsByTagName("image");
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
NodeList partAttrChildList = partAttrNode.getChildNodes();
Rectangle tempRect = new Rectangle(partRect);
if (partAttrChildList.getLength() == 1)
{
if (isHands)
{
obj = new ModelHand(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
else if (isBackground)
{
obj = new ModelBackground(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
else if (isIndex)
{
String tmpStr = metaElmnt.getAttribute("image");
if (!tmpStr.isEmpty())
{
obj = new ModelIndex(parent, this.path, tmpStr);
obj.setRect(tempRect);
((ModelIndex)obj).setOriginalRect(new Rectangle(Integer.parseInt(metaElmnt.getAttribute("x")),
Integer.parseInt(metaElmnt.getAttribute("y")),
Integer.parseInt(metaElmnt.getAttribute("width")),
Integer.parseInt(metaElmnt.getAttribute("height"))));
}
else
{
obj = new ModelIndex(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
tmpStr = metaElmnt.getAttribute("range");
if (tmpStr.isEmpty()) {
return null;
}
((ModelIndex)obj).setRange(0.0D, Integer.parseInt(tmpStr));
tmpStr = metaElmnt.getAttribute("number");
((ModelIndex)obj).setNumber(Integer.parseInt(tmpStr));
((ModelIndex)obj).apply();
((ModelIndex)obj).setRect(tempRect);
}
else
{
obj = new ModelImage(parent, this.path, partAttrElmnt.getTextContent());
obj.setRect(tempRect);
}
}
else {
Application.LOGGER.error("LoadXml : Implement me - image condition, length=" + partAttrChildList.getLength());
}
}
if (obj != null)
{
partAttrList = partElmt.getElementsByTagName("color");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String tmpStr = partAttrElmnt.getAttribute("a");
if (!tmpStr.isEmpty())
{
tmpStr = partAttrElmnt.getAttribute("r");
if (!tmpStr.isEmpty())
{
obj.setFilterEnable(true);
float[] hsl = Color.RGBtoHSB(Integer.parseInt(partAttrElmnt.getAttribute("r")),
Integer.parseInt(partAttrElmnt.getAttribute("g")),
Integer.parseInt(partAttrElmnt.getAttribute("b")), null);
obj.setHue((int)(hsl[0] * 360.0F - 180.0F));
obj.setSaturation((int)(hsl[1] * 200.0F - 100.0F));
obj.setLightness((int)(hsl[2] * 200.0F - 100.0F));
obj.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
else
{
obj.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
}
}
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String source = partAttrElmnt.getAttribute("source");
if (!source.isEmpty())
{
if (isHands)
{
ModelHand hand = (ModelHand)obj;
hand.setSource(Source.findById(source));
if (!partElmt.getAttribute("x").isEmpty())
{
hand.setPivot(Integer.parseInt(partAttrElmnt.getAttribute("center_x")) +
Integer.parseInt(partElmt.getAttribute("x")),
Integer.parseInt(partAttrElmnt.getAttribute("center_y")) +
Integer.parseInt(partElmt.getAttribute("y")));
hand.setStartAngle(Double.parseDouble(partAttrElmnt.getAttribute("start_angle")));
hand.setEndAngle(Double.parseDouble(partAttrElmnt.getAttribute("end_angle")));
hand.setStartValue(Double.parseDouble(partAttrElmnt.getAttribute("start_value")));
hand.setEndValue(Double.parseDouble(partAttrElmnt.getAttribute("end_value")));
}
else
{
if (group == null) {
hand.setPivot(Integer.parseInt(partAttrElmnt.getAttribute("center_x")),
Integer.parseInt(partAttrElmnt.getAttribute("center_y")));
}
hand.setStartAngle(Double.parseDouble(partAttrElmnt.getAttribute("start_angle")));
hand.setEndAngle(Double.parseDouble(partAttrElmnt.getAttribute("end_angle")));
hand.setStartValue(Double.parseDouble(partAttrElmnt.getAttribute("start_value")));
hand.setEndValue(Double.parseDouble(partAttrElmnt.getAttribute("end_value")));
}
if (partAttrElmnt.getAttribute("animation").equals("tick"))
{
hand.setTensionFrame(Integer.parseInt(partAttrElmnt.getAttribute("tick_frame")) / 2);
hand.setTensionAngle(Double.parseDouble(partAttrElmnt.getAttribute("tick_angle")));
hand.setTension((int)(hand.getTensionAngle() * 100.0D / 6.0D));
hand.setTensionEnabled(true);
}
if (source.equals("hour0-11.minute"))
{
hand.setSource(Source.findById("hour0-23.minute"));
if (hand.getStartAngle() < hand.getEndAngle()) {
hand.setEndAngle(hand.getEndAngle() + 360.0D);
} else {
hand.setEndAngle(hand.getEndAngle() - 360.0D);
}
}
}
}
else if (!partAttrElmnt.getAttribute("angle").isEmpty()) {
if (Util.checkExprTag(partAttrElmnt.getAttribute("angle"))) {
obj.setAngle(Util.removeExprTag(partAttrElmnt.getAttribute("angle")));
} else {
obj.setAngle(Double.parseDouble(partAttrElmnt.getAttribute("angle")));
}
}
}
}
}
else
{
partAttrList = partElmt.getElementsByTagName("image-set");
if (partAttrList.getLength() != 0)
{
ModelAnimation ani = new ModelAnimation(parent);
int frameNum = 0;
ani.setRect(partRect);
NodeList imageSetChildList = partAttrList.item(0).getChildNodes();
for (int nodeIndex = 0; nodeIndex < imageSetChildList.getLength(); nodeIndex++)
{
Node imageSetChildNode = imageSetChildList.item(nodeIndex);
if (imageSetChildNode.getNodeType() == 1)
{
if (imageSetChildNode.getNodeName().equals("image"))
{
Element imageElmnt = (Element)imageSetChildNode;
ModelImage frameItem = new ModelImage(ani, this.path, imageElmnt.getTextContent());
frameItem.setRect(0, 0, partRect.width, partRect.height);
frameItem.setId("Frame " + (nodeIndex + 1));
frameItem.getCondition().deleteAll();
frameItem.getCondition().addItem(frameNum, frameNum + 1);
}
frameNum++;
}
}
partAttrList = partElmt.getElementsByTagName("color");
if (partAttrList.getLength() != 0)
{
partAttrNode = partAttrList.item(0);
partAttrElmnt = (Element)partAttrNode;
String tmpStr = partAttrElmnt.getAttribute("a");
if (!tmpStr.isEmpty()) {
ani.setAlpha(Integer.parseInt(partAttrElmnt.getAttribute("a")));
}
}
partAttrList = partElmt.getElementsByTagName("rotation");
if (partAttrList.getLength() != 0)
{
partAttrElmnt = (Element)partAttrList.item(0);
if (!partAttrElmnt.getAttribute("angle").isEmpty()) {
if (Util.checkExprTag(partAttrElmnt.getAttribute("angle"))) {
ani.setAngle(Util.removeExprTag(partAttrElmnt.getAttribute("angle")));
} else {
ani.setAngle(Double.parseDouble(partAttrElmnt.getAttribute("angle")));
}
}
}
return ani;
}
}
return obj;
}
Click to expand...
Click to collapse

Categories

Resources