SPB Weather Templates - 8525, TyTN, MDA Vario II, JasJam ROM Development

Anyone using SPB Weather on WM devices you can visit the following link to download a template and pull updates for your area which is not listed in the pull down lists.
http://www.pdagold.com/themes/list.asp?tp=11
While I live in the US I've attacted the US template for quick download as my small town was not listed in the pull down list.
Instructions
Weather.com template for Spb Weather:
1.Create \templates subfolder in Program Files\Spb Weather
Copy *.tpl file to this folder. (Use ActiveSync-Explorer for it)
2.Go to the Options of Spb Weather->Tools->Weather Sources
3.Click on Add button
4.Click on Browse button
5.Specify the folder where you placed *.tpl file
6.Select your file from this folder and Click on OK
7.Click OK Again and Again
8.Go to the Cities Tab in Options and Click to Add button
9.Select the Custom menuitem
10.Type your City name
11.Select Weather.com in Forecasts listbox
12.There you should know your city code, e.g. RSXX0091 for Saint-Petersburg, Russia
this code is mentioned in URL:
http://www.weather.com/outlook/travel/businesstraveler/hourbyhour/RSXX0091?from=36hr_topnav_business
(US users may use ZIP code as citycodes)
Enter your city code.
14.Click Ok and Ok again
15.That's all Refresh your City and you will get the weather forecast from Weather.com
If this post is duplicated then please PM or indicate so, or even attach to approperiate thread.
Enjoy...

I got the following error after getting the template and following upper instructions:
Error Compiling weather template (error3)
Statement expected at line 1.
I already soft reset, but nothing changed.
this is the template
main
{
debug_log;
pointer dayStart
{
go_start;
skip_to_text("Meer opties en vergroten", false);
};
pointer dayEnd
{
skip_to_text("show-radar-big", true);
};
pointer weatherStart
{
skip_to_text("row_weathericons\">", false);
};
pointer weatherEnd
{
skip_to_text("Neersl. <span>", true);
};
map skyMap
{
key_value( "bd_x", "5");
key_value( "bdg1_x", "13");
key_value( "bdg2_x", "13");
key_value( "bdg3_x", "13");
key_value( "bdr1_x", "7");
key_value( "bdr2_x", "8");
key_value( "bdr3_x", "8");
key_value( "bds1_x", "7");
key_value( "bds2_x", "8");
key_value( "bds3_x", "8");
key_value( "bdsn1x", "10");
key_value( "bdsn2x", "11");
key_value( "bdsn3x", "11");
key_value( "bdsns1", "10");
key_value( "bdsns2", "11");
key_value( "bdsns3", "11");
key_value( "bw_x", "5");
key_value( "bwg1_x", "13");
key_value( "bwg2_x", "13");
key_value( "bwg3_x", "13");
key_value( "bwr1_x", "7");
key_value( "bwr2_x", "8");
key_value( "bwr3_x", "8");
key_value( "bws1_x", "7");
key_value( "bws2_x", "8");
key_value( "bws3_x", "8");
key_value( "bwsn1x", "10");
key_value( "bwsn2x", "11");
key_value( "bwsn3x", "11");
key_value( "bwsns1", "10");
key_value( "bwsns2", "11");
key_value( "bwsns3", "11");
key_value( "mb_x", "19");
key_value( "mbg1_x", "15"); //test
key_value( "mbg2_x", "15");//test
key_value( "mbg3_x", "15");//test
key_value( "mbr1_x", "21");
key_value( "mbr2_x", "22");
key_value( "mbr3_x", "22");
key_value( "mbs1_x", "21");
key_value( "mbs2_x", "22");
key_value( "mbs3_x", "22");
key_value( "mbsn1x", "24");
key_value( "mbsn2x", "25");
key_value( "mbsn3x", "25");
key_value( "mbsns1", "24");
key_value( "mbsns2", "24");
key_value( "mbsns3", "24");
key_value( "md_x", "20");
key_value( "mdg1_x", "13");
key_value( "mdg2_x", "13");
key_value( "mdg3_x", "13");
key_value( "mdr1_x", "21");
key_value( "mdr2_x", "22");
key_value( "mdr3_x", "22");
key_value( "mds1_x", "21");
key_value( "mds2_x", "22");
key_value( "mds3_x", "22");
key_value( "mdsn1x", "24");
key_value( "mdsn2x", "25");
key_value( "mdsn3x", "25");
key_value( "mdsns1", "24");
key_value( "mdsns2", "25");
key_value( "mdsns3", "25");
key_value( "mo_x", "17");
key_value( "mm_x", "18");
key_value( "ms_x", "2");
key_value( "mw_x", "20");
key_value( "mwg1_x", "27");
key_value( "mwg2_x", "27");
key_value( "mwg3_x", "27");
key_value( "mwr1_x", "21");
key_value( "mwr2_x", "22");
key_value( "mwr3_x", "22");
key_value( "mws1_x", "21");
key_value( "mws2_x", "22");
key_value( "mws3_x", "22");
key_value( "mwsn1x", "24");
key_value( "mwsn2x", "25");
key_value( "mwsn3x", "25");
key_value( "mwsns1", "24");
key_value( "mwsns2", "25");
key_value( "mwsns3", "25");
key_value( "nb_x", "6"); // mist
key_value( "nm_x", "18");
key_value( "ns_x", "6"); // mist
key_value( "so_x", "1");
key_value( "wb_x", "4");
key_value( "wbg1_x", "15");
key_value( "wbg2_x", "15");
key_value( "wbg3_x", "15");
key_value( "wbr1_x", "14");
key_value( "wbr2_x", "14");
key_value( "wbr3_x", "14");
key_value( "wbs1_x", "14");
key_value( "wbs2_x", "14");
key_value( "wbs3_x", "14");
key_value( "wbsn1x", "16");
key_value( "wbsn2x", "16");
key_value( "wbsn3x", "16");
key_value( "wbsns1", "16");
key_value( "wbsns2", "16");
key_value( "wbsns3", "16");
};
map windDirMap
{
key_value( "N", "N");
key_value( "NNO", "NNE");
key_value( "NO", "NE");
key_value( "ONO", "ENE");
key_value( "O", "E");
key_value( "OZO", "ESE");
key_value( "ZO", "SE");
key_value( "ZZO", "SSE");
key_value( "Z", "S");
key_value( "ZZW", "SSW");
key_value( "ZW", "SW");
key_value( "WZW", "WSW");
key_value( "W", "W");
key_value( "WNW", "WNW");
key_value( "NW", "NW");
key_value( "NNW", "NNW");
};
map windSpeedMap
{
key_value( "0", "0");
key_value( "1", "3");
key_value( "2", "8");
key_value( "3", "15");
key_value( "4", "25");
key_value( "5", "33");
key_value( "6", "45");
key_value( "7", "55");
key_value( "8", "70");
key_value( "9", "80");
key_value( "10", "95");
key_value( "11", "110");
key_value( "12", "120");
};
string wind_s_3_o;
string wind_r_3_o;
string wind_s_3_m;
string wind_r_3_m;
string wind_s_3_a;
string wind_r_3_a;
string wind_s_2_o;
string wind_r_2_o;
string wind_s_2_m;
string wind_r_2_m;
string wind_s_2_a;
string wind_r_2_a;
string wind_s_1_o;
string wind_r_1_o;
string wind_s_1_m;
string wind_r_1_m;
string wind_s_1_a;
string wind_r_1_a;
string windSpeedUnits = "kph";
string tmprUnits = "C";
open_url("http://www.weeronline.nl/Europa/Nederland/" + CityCode, "GET");
string hour = "";
string sky = "";
string dayOfWeek = "";
string dayOfMonth = "";
string dagindex = "";
string windDirection;
string windSpeed;
select_area(dayStart, dayEnd);
skip_to_text("TodayText\">", false);
skip_to_text(" ", false);
begin_var;
skip_to_chars(" ");
string day1 = end_var;
skip_to_text("TomorrowText\">", false);
skip_to_text(" ", false);
begin_var;
skip_to_chars(" ");
string day2 = end_var;
skip_to_text("Day3Text\">", false);
skip_to_text(" ", false);
begin_var;
skip_to_chars(" ");
string day3 = end_var;
skip_to_text("Day4Text\">", false);
skip_to_text(" ", false);
begin_var;
skip_to_chars(" ");
string day4 = end_var;
skip_to_text("Day5Text\">", false);
skip_to_text(" ", false);
begin_var;
skip_to_chars(" ");
string day5 = end_var;
select_area(weatherStart , weatherEnd);
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_o_1 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_m_1 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_a_1 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_o_2 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_m_2 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_a_2 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_o_3 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_m_3 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_a_3 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_o_4 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_m_4 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_a_4 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_o_5 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_m_5 = end_var;
skip_to_text("icons2/", false);
begin_var;
skip_to_chars(".");
string sky_a_5 = end_var;
skip_to_text("Min", false);
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_l_1 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_l_2 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_l_3 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_l_4 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_l_5 = end_var;
skip_to_text("Max", false);
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_h_1 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_h_2 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_h_3 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_h_4 = end_var;
skip_to_text("<td", false);
skip_to_text(">", false);
begin_var;
skip_to_chars("&");
string temp_h_5 = end_var;
skip_to_text("Wind", false);
skip_to_text("title=\"Windkracht ", false);
begin_var;
skip_to_chars(" ");
string wind1 = end_var;
skip_to_text("Bft, ", false);
begin_var;
skip_to_chars("\"");
string windr1 = end_var;
skip_to_text("title=\"Windkracht ", false);
begin_var;
skip_to_chars(" ");
string wind2 = end_var;
skip_to_text("Bft, ", false);
begin_var;
skip_to_chars("\"");
string windr2 = end_var;
skip_to_text("title=\"Windkracht ", false);
begin_var;
skip_to_chars(" ");
string wind3 = end_var;
skip_to_text("Bft, ", false);
begin_var;
skip_to_chars("\"");
string windr3 = end_var;
skip_to_text("title=\"Windkracht ", false);
begin_var;
skip_to_chars(" ");
string wind4 = end_var;
skip_to_text("Bft, ", false);
begin_var;
skip_to_chars("\"");
string windr4 = end_var;
skip_to_text("title=\"Windkracht ", false);
begin_var;
skip_to_chars(" ");
string wind5 = end_var;
skip_to_text("Bft, ", false);
begin_var;
skip_to_chars("\"");
string windr5 = end_var;
string tmprLo=temp_l_1;
string tmprHi=temp_h_1;
dayOfWeek = "";
dayOfMonth = day1;
hour = "09";
sky=skyMap[sky_o_1];
windSpeed=windSpeedMap[wind1];
windDirection=windDirMap[windr1];
add_day;
hour = "12";
sky=skyMap[sky_m_1];
add_day;
hour = "18";
sky=skyMap[sky_a_1];
add_day;
dayOfMonth = day2;
tmprLo=temp_l_2;
tmprHi=temp_h_2;
hour = "09";
sky=skyMap[sky_o_2];
windSpeed=windSpeedMap[wind2];
windDirection=windDirMap[windr2];
add_day;
hour = "12";
sky=skyMap[sky_m_2];
add_day;
hour = "18";
sky=skyMap[sky_a_2];
add_day;
dayOfMonth = day3;
tmprLo=temp_l_3;
tmprHi=temp_h_3;
hour = "09";
sky=skyMap[sky_o_3];
windSpeed=windSpeedMap[wind3];
windDirection=windDirMap[windr3];
add_day;
hour = "12";
sky=skyMap[sky_m_3];
add_day;
hour = "18";
sky=skyMap[sky_a_3];
add_day;
dayOfMonth = day4;
tmprLo=temp_l_4;
tmprHi=temp_h_4;
hour = "09";
sky=skyMap[sky_o_4];
windSpeed=windSpeedMap[wind4];
windDirection=windDirMap[windr4];
add_day;
hour = "12";
sky=skyMap[sky_m_4];
add_day;
hour = "18";
sky=skyMap[sky_a_4];
add_day;
dayOfMonth = day5;
tmprLo=temp_l_5;
tmprHi=temp_h_5;
hour = "09";
sky=skyMap[sky_o_5];
windSpeed=windSpeedMap[wind5];
windDirection=windDirMap[windr5];
add_day;
hour = "12";
sky=skyMap[sky_m_5];
add_day;
hour = "18";
sky=skyMap[sky_a_5];
add_day;
}
I added the citycode as stated on http://www.weeronline.nl/Europa/Nederland/Nijkerk/4057639
I used the code Nijkerk/4057639 (which should be the correct one)
Does anyone have an idea what goes wrong???
Cheers,
Arnold

Related

Javascript coder wanted for help in the kitchen...

I (or rather, all of us...) need some code, and I've never really done any Javascript.
Could someone please code:
- Enable all controls on form 0 of a document.
- Walk through all the controls in order. For each control:
- Make a temporary string that holds the name of the control
- add a slash and the value of the control if it is a checkbox
- Walk through all the controls again
- Disable any controls:
- whose name is longer, but starts with the temp string above
- which are radiobuttons whose name is the temp-string
- done
This would disable any controls that do not apply when the user deselects a higher-level checkbox or radio-button, which would look much cleaner and cooler. I would have to spend most of today on this learning enough Javascript and fixing stupid beginner-bugs, and I would be disapointed if we don't have at least a few people here who can code this in 10 minutes.
Code can be tested by copying the form from the kitchen locally and creating a function to replace the submit placed at every checkbox or radiobutton control.
ok, consider this a beta
i did not follow your design in whole
but still i hope the functionality is the same
email me to [email protected] for any needed changes
my local time is 2:31 after midnight
uh uaah, good night
Code:
<html>
<head>
<script>
function setupDisable() {
var myForm = document.getElementById('myForm');
// enable all of them
for(var i=0; i<myForm.elements.length; i++) {
myForm.elements[i].disabled = false;
}
// foreach assign a tmpName
for(var i=0; i<myForm.elements.length; i++) {
var tmpName = myForm.elements[i].name;
if (myForm.elements[i].type == 'checkbox') {
// IMHO this is not needed and will break the functionality
// and this fact renders this whole cycle useless :)
// you can just use the name
// property in fuiction doDisable...
//tmpName += '/' + myForm.elements[i].value;
}
myForm.elements[i].tmpName = tmpName;
}
}
function doDisable(root) {
// disable all children
var myName = root.tmpName;
var myForm = document.getElementById('myForm');
if (!root.checked) {
alert('went off');
for(var i=0; i<myForm.elements.length; i++) {
var actName = myForm.elements[i].name;
if (actName.indexOf(myName) == 0 && actName != myName) {
myForm.elements[i].disabled = true;
}
}
} else {
alert('went on');
for(var i=0; i<myForm.elements.length; i++) {
var actName = myForm.elements[i].name;
if (actName.indexOf(myName) == 0 && actName != myName) {
myForm.elements[i].disabled = false;
}
}
}
}
</script>
</head>
<body onload="setupDisable()">
<form id="myForm">
<INPUT TYPE="checkbox" name="in1" onclick="doDisable(this)">in1
<INPUT TYPE="checkbox" name="in2" onclick="doDisable(this)">in2
<INPUT TYPE="radio" name="in2/1" value="1" onclick="doDisable(this)">in2/1
<INPUT TYPE="radio" name="in2/1" value="2" onclick="doDisable(this)">in2/1
<INPUT TYPE="radio" name="in2/1" value="3" onclick="doDisable(this)">in2/1
</form>
</body>
</html>

Problem with Dynamic Pivot

Hello everyone,
I have a problem with Dynamic Pivot. I create Dynamic Pivot and binding data to it, but Pivot not display content.I tried using MVVM pattern to create Dynamic Pivot and it work well. But I still not know why is it worked (with MVVM).
But i don't want use MVVM pattern in this case. Please tell me know why it not work and how to fix it.
Please see below or download project demo (file attached) to more know . Thanks
XAML
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controlsivot x:Name="PivotPlatform" Margin="0,0,8,77" Title="BindingDynamicPivotDemo" ItemsSource="{Binding PivotItems}" >
<controlsivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</controlsivot.HeaderTemplate>
<controlsivot.ItemTemplate>
<DataTemplate>
<StackPanel>
<Image Source="{Binding ImagePath}" />
<StackPanel>
<TextBlock Text="{Binding Address}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</controlsivot.ItemTemplate>
</controlsivot>
</Grid>
Code Behind:
public ObservableCollection<Food> PivotItems { get; set; }
public MainPage()
{
InitializeComponent();
// Set the data context of the listbox control to the sample data
//DataContext = App.ViewModel;
PivotItems = new ObservableCollection<Food>();
LoadData();
}
public void LoadData()
{
XDocument loadedData = XDocument.Load("food.xml");
List<Food> data = (from query in loadedData.Descendants("food")
select new Food()
{
Id = (int)query.Element("id"),
Name = (string)query.Element("name"),
Address = (string)query.Element("address"),
ImagePath = (string)query.Element("imagepath"),
Thumbnail = (string)query.Element("thumbnail")
}).ToList();
for (int i = 0; i < data.Count; i++)
{
Food food = (Food)data;
Food header = new Food { Name = food.Name, Address = food.Address, ImagePath = food.ImagePath };
PivotItems.Add(header);
}
}
If you use MVVM the DataContext is set to the MainViewModelSataSource (e.g.).
You have to set the DataContext to your MainPage code.
Code:
<phone:PhoneApplicationPage
[U]x:Name="mainPage"[/U]
x:Class="BindingDynamicPivotDemo.MainPage"
and
Code:
<controls:Pivot x:Name="PivotPlatform" Margin="0,0,8,77" Title="BindingDynamicPivotDemo" ItemsSource="{Binding PivotItems}" [U]DataContext="{Binding ElementName=mainPage}[/U]">
should work
By the way, this probably should go in the Software Development sub-forum. It's dev-related, but doesn't appear to be hacking-related and is more just a general app development question.
Moved to Software Development so you get a few more hits
If you use Caliburn Micro doing this is really simple.
http://caliburnmicro.codeplex.com/S...aliburn.Micro.HelloWP71/PivotPageViewModel.cs

[Guide] Floating in circular boundary (or rectangular) with accelerometer sensor

This guide is about floating, moving a point in coordinate system.
It may be useful to make spirit level (bubble level) or magic 8 ball and so on
Just use device's accelerometer sensor to moving a center point.
I wrote android custom view which implements SensorEventListener.
Do some initialization (measuring screen size, set boundary size, assign values...) first.
Draw the x, y axis and boundary and little circle.
In end of the onDraw(), invalidate() makes little circle keep moving.
{
"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"
}
Important formula to make little circle inside circular boundary is below.
Code:
private void calc(){
//for simulating object floating on water
//against gravity
xCon += mSensorX;
yCon -= mSensorY;
/*
//for simulating object rolling on ground
//adjust to gravity
xCon -= mSensorX;
yCon += mSensorY;
*/
//for circular boundary
if(Math.pow(xCon, 2) + Math.pow(yCon, 2) >= boundarySquare){
isBoundaryOut = true;
[COLOR="SeaGreen"] if(xCon != 0 && yCon != 0){
radian = (float) Math.atan2(yCon, xCon);
}[/COLOR]
[COLOR="RoyalBlue"] xCon = (float) (Math.cos(radian) * boundary);
yCon = (float) (Math.sin(radian) * boundary);[/COLOR]
}
else{
isBoundaryOut = false;
}
}
add the sensor's value to x, y coordinate (xCon, yCon) and check it is out of the circular boundary.
If it is change the value with the Formula
x = cos(atan2(y, x)) * CIRCULAR_BOUDNARY_RADIUS
y = sin(atan2(y, x)) * CIRCULAR_BOUDNARY_RADIUS
You can select the circle to float on water or roll on ground just change addition <-> subtraction.
- For simulating object floating on water, against gravity
xCon += mSensorX;
yCon -= mSensorY;
- For simulating object rolling on ground, adjust to gravity
xCon -= mSensorX;
yCon += mSensorY;
Also you can change boundary shape easily
For rectangle boundary
if(xCon > horizontalBound){
xCon = horizontalBound;
}
else if(xCon < -horizontalBound){
xCon = -horizontalBound;
}
if(yCon > verticalBound){
yCon = verticalBound;
}
else if(yCon < -verticalBound){
yCon = -verticalBound;
}
Code:
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER)
return;
mSensorX = sensor_weight * event.values[0];
mSensorY = sensor_weight * event.values[1];
}
onSensorChanged() I just add sensor values(weighted) to center point x, y and it seems to be quite enough to do rough simulation.
Whole source code of my custom view is like below.
Code:
package net.gerosyab.circularboundary;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.util.AttributeSet;
import android.view.Display;
import android.view.Surface;
import android.view.View;
import android.view.WindowManager;
public class MyView extends View implements SensorEventListener{
Context context;
//weight for calculating speed of floating image
//multiplied with accelrometer sensor value
//faster if it is more than 1
//slower if it is less than 1
float sensor_weight = 2.15f;
float width;
float height;
float cx;
float cy;
float x;
float y;
float xCon, yCon;
float boundary;
float boundarySquare;
float dotRadius = 15;
float radian;
Paint linePaint, circlePaint, dotPaint, textPaint;
float horizontalBound;
float verticalBound;
boolean isBoundaryOut = false;
private float mSensorX;
private float mSensorY;
private SensorManager mSensorManager;
private Sensor mAccelerometer;
private WindowManager mWindowManager;
private Display mDisplay;
public MyView(Context context) {
super(context);
this.context = context;
init();
}
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init();
}
public MyView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.context = context;
init();
}
private void init(){
linePaint = new Paint();
circlePaint = new Paint();
dotPaint = new Paint();
textPaint = new Paint();
linePaint.setColor(Color.WHITE );
linePaint.setAntiAlias(true);
linePaint.setStrokeWidth(2);
linePaint.setStyle(Paint.Style.STROKE);
circlePaint.setColor(Color.YELLOW);
circlePaint.setAntiAlias(true);
circlePaint.setStrokeWidth(2);
circlePaint.setStyle(Paint.Style.STROKE);
dotPaint.setColor(Color.RED);
dotPaint.setAntiAlias(true);
dotPaint.setStrokeWidth(5);
dotPaint.setStyle(Paint.Style.FILL);
textPaint.setColor(Color.WHITE);
textPaint.setAntiAlias(true);
textPaint.setStyle(Paint.Style.FILL_AND_STROKE);
textPaint.setTextSize(40);
x = cx;
y = cy;
xCon = 0;
yCon = 0;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//draw x, y axis
canvas.drawLine(cx, 0, cx, height, linePaint);
canvas.drawLine(0, cy, width, cy, linePaint);
//draw circular boundary
canvas.drawCircle(cx, cy, boundary, circlePaint);
canvas.drawRect(cx - horizontalBound, cy - verticalBound, cx + horizontalBound, cy + verticalBound, circlePaint);
calc();
//draw dot
canvas.drawCircle(xCon + cx, yCon + cy, dotRadius, dotPaint);
//draw text
canvas.drawText("isBoundaryOut : " + isBoundaryOut, 100, 50, textPaint);
canvas.drawText("sensorX : " + mSensorX, 100, 100, textPaint);
canvas.drawText("sensorY : " + mSensorY, 100, 150, textPaint);
canvas.drawText("xCon : " + xCon, 100, 200, textPaint);
canvas.drawText("yCon : " + yCon, 100, 250, textPaint);
canvas.drawText("cx : " + cx, 100, 300, textPaint);
canvas.drawText("cy : " + cy, 100, 350, textPaint);
canvas.drawText("horizontalBound : " + horizontalBound, 100, 400, textPaint);
canvas.drawText("verticalBound : " + verticalBound, 100, 450, textPaint);
invalidate();
}
private void calc(){
//for simulating object floating on water
//against gravity
xCon += mSensorX;
yCon -= mSensorY;
/*
//for simulating object rolling on ground
//adjust to gravity
xCon -= mSensorX;
yCon += mSensorY;
*/
/*
//for rectangle boundary
if(xCon > horizontalBound){
xCon = horizontalBound;
}
else if(xCon < -horizontalBound){
xCon = -horizontalBound;
}
if(yCon > verticalBound){
yCon = verticalBound;
}
else if(yCon < -verticalBound){
yCon = -verticalBound;
}
*/
//for circular boundary
if(Math.pow(xCon, 2) + Math.pow(yCon, 2) >= boundarySquare){
isBoundaryOut = true;
if(xCon != 0 && yCon != 0){
radian = (float) Math.atan2(yCon, xCon);
}
xCon = (float) (Math.cos(radian) * boundary);
yCon = (float) (Math.sin(radian) * boundary);
}
else{
isBoundaryOut = false;
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
width = getWidth();
height = getHeight();
cx = width / 2;
cy = height / 2;
boundary = width * 0.15f;
horizontalBound = boundary;
verticalBound = boundary;
boundarySquare = boundary * boundary;
mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
// Get an instance of the WindowManager
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
mDisplay = mWindowManager.getDefaultDisplay();
mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_UI);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER)
return;
switch (mDisplay.getRotation()) {
case Surface.ROTATION_0:
mSensorX = sensor_weight * event.values[0];
mSensorY = sensor_weight * event.values[1];
break;
case Surface.ROTATION_90:
mSensorX = sensor_weight * -event.values[1];
mSensorY = sensor_weight * event.values[0];
break;
case Surface.ROTATION_180:
mSensorX = sensor_weight * -event.values[0];
mSensorY = sensor_weight * -event.values[1];
break;
case Surface.ROTATION_270:
mSensorX = sensor_weight * event.values[1];
mSensorY = sensor_weight * -event.values[0];
break;
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mSensorManager.unregisterListener(this);
}
}
Hope this is helpful!
Thanks

Hooking a protected List in an Inner Class with an odd set of Parameters

So, I'm getting fairly good at hooking and modifying classes, but this one is so unique, I'm not quite sure how to approach hooking it to do what I want. Code for the method/class I want to attack:
Code:
private class CreateLaunchPointListTask
extends AsyncTask<Void, Void, List<LaunchPoint>>
{
private CreateLaunchPointListTask() {}
protected List<LaunchPoint> doInBackground(Void... paramVarArgs)
{
paramVarArgs = mContext.getString(2131558445);
Object localObject = new Intent("android.intent.action.MAIN");
((Intent)localObject).addCategory(paramVarArgs);
paramVarArgs = new LinkedList();
PackageManager localPackageManager = mContext.getPackageManager();
localObject = localPackageManager.queryIntentActivities((Intent)localObject, 129);
int j = ((List)localObject).size();
int i = 0;
while (i < j)
{
ResolveInfo localResolveInfo = (ResolveInfo)((List)localObject).get(i);
if (activityInfo != null) {
paramVarArgs.add(new LaunchPoint(mContext, localPackageManager, localResolveInfo));
}
i += 1;
}
return paramVarArgs;
}
public void onPostExecute(List<LaunchPoint> arg1)
{
synchronized (mLock)
{
mAllLaunchPoints.clear();
mAllLaunchPoints.addAll(???);
synchronized (mCachedActions)
{
LaunchPointListGenerator.access$502(LaunchPointListGenerator.this, true);
if (!mCachedActions.isEmpty()) {
((LaunchPointListGenerator.CachedAction)mCachedActions.remove()).apply();
}
}
}
LaunchPointListGenerator.access$602(LaunchPointListGenerator.this, true);
Iterator localIterator = mListeners.iterator();
while (localIterator.hasNext()) {
((LaunchPointListGenerator.Listener)localIterator.next()).onLaunchPointListGeneratorReady();
}
}
}
So, while this is a big chunk of code, everything I want to do is really in the first few lines:
Code:
paramVarArgs = mContext.getString(2131558445);
Object localObject = new Intent("android.intent.action.MAIN");
((Intent)localObject).addCategory(paramVarArgs);
So, string 2131558445 is a specific intent. What I would like to do is add *another* category after 2131558445 is added to localObject.
That would be the simplest implementation.
A more advanced implementation would be to actually and return a second LinkedList, paramVarArgs2, that only matches up to the second intent category that we're inserting.
Any help would be greatly appreciated.

GWD sources

It seems the ALARM and NOTIFICATION sources aren't shown in GWD. But they may be useable by modding the xml. Likely as sources for a hand, text, digital clock etc.
Code:
package com.samsung.gwd.source;
import java.util.HashMap;
public class Source
{
public static final String SOURCE_CALORIE_CAL = "cal";
public static final String SOURCE_CALORIE_KCAL = "kcal";
public static final String SOURCE_CALORIE_UNIT_CAL = "(cal)";
public static final String SOURCE_CALORIE_UNIT_KCAL = "(kcal)";
public static final String SOURCE_DISTANCE_M = "m";
public static final String SOURCE_DISTANCE_KM = "km";
public static final String SOURCE_DISTANCE_MILE = "mile";
public static final String SOURCE_DISTANCE_UNIT_M = "(m)";
public static final String SOURCE_DISTANCE_UNIT_KM = "(km)";
public static final String SOURCE_DISTANCE_UNIT_MILE = "(mile)";
public static final String SOURCE_SPEED_M = "m/s";
public static final String SOURCE_SPEED_KM = "km/h";
public static final String SOURCE_SPEED_MILE = "mile/h";
public static final String SOURCE_SPEED_UNIT_M = "(m/s)";
public static final String SOURCE_SPEED_UNIT_KM = "(km/h)";
public static final String SOURCE_SPEED_UNIT_MILE = "(mile/h)";
public static final String SOURCE_TEMPERATURE_C = "�C";
public static final String SOURCE_TEMPERATURE_F = "�F";
public static final String SOURCE_TEMPERATURE_K = "�K";
public static final String SOURCE_TEMPERATURE_UNIT_C = "(�C)";
public static final String SOURCE_TEMPERATURE_UNIT_F = "(�F)";
public static final String SOURCE_TEMPERATURE_UNIT_K = "(�K)";
public static final String SOURCE_HUMIDITY_PERCENT = "%";
public static final String SOURCE_HUMIDITY_UNIT_PERCENT = "(%)";
public static final String WEATHER_DISPLAY_TYPE_ICON = "Icon";
public static final String WEATHER_DISPLAY_TYPE_MAIN = "Main";
public static final String WEATHER_DISPLAY_TYPE_DESCRIPTION = "Description";
public static final String WEATHER_DISPLAY_TYPE_NUMBER = "Number";
public static final String WEATHER_DISPLAY_TYPE_ID = "ID";
public static final Source NONE = new Source("None", "none", 0.0D, 0.0D, false, 0.0D, 0.0D, null, new String[] { "None" });
public static final Source HOUR = new Source("Hour in Day", "hour0-23", 0.0D, 24.0D, true, 0.0D, 720.0D, null, new String[] { "%d" });
public static final Source HOUR_MINUTE = new Source("Hour in Day", "hour0-23.minute", 0.0D, 24.0D, true, 0.0D, 720.0D, null, new String[] { "%f" });
public static final Source MINUTE = new Source("Minute in Hours", "minute", 0.0D, 60.0D, false, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source MINUTE_SECOND = new Source("Minute in Hours", "minute.second", 0.0D, 60.0D, true, 0.0D, 360.0D, null, new String[] { "%f" });
public static final Source SECOND = new Source("Second in Minute", "second", 0.0D, 60.0D, false, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source SECOND_SWEEP = new Source("Second in Minute", "second.millisecond", 0.0D, 60.0D, true, 0.0D, 360.0D, null, new String[] { "%f" });
public static final Source DAY = new Source("Day of Month", "day", 0.0D, 31.0D, false, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source MONTH = new Source("Month of Year", "month", 0.0D, 12.0D, false, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source DAY_OF_WEEK = new Source("Day of Week", "dayOfWeek", 1.0D, 8.0D, false, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source DAY_OF_YEAR = new Source("Day of Year", "month0-11.day", 0.0D, 12.0D, true, 0.0D, 360.0D, null, new String[] { "%d" });
public static final Source BATTERY_PERCENT = new Source("Battery %", "battery.percent", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "%d %", "%d", "% %d" });
public static final Source BATTERY_LEVEL = new Source("Battery Level", "battery.level", 0.0D, 4.0D, false, 0.0D, 360.0D,
null, new String[] { "%d" });
public static final Source BATTERY_CHARGING_STATUS = new Source("Battery charging status", "battery.chargingStatus", 0.0D, 1.0D, false, 0.0D, 180.0D,
null, new String[] { "%d" });
public static final Source PEDOMETER_STEP_PERCENT = new Source("Steps %", "pedometer.stepPercent", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d %", "%d", "% %d" });
public static final Source PEDOMETER_CALORIE = new Source("Burned calorie", "pedometer.calorie", 0.0D, 1000000.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d kcal",
"%d (kcal)" },
new String[] { "kcal" },
new String[] { "0" },
"kcal", "0");
public static final Source PEDOMETER_DISTANCE = new Source("Moved distance", "pedometer.distance", 0.0D, 10000.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d km",
"%d m",
"%d mile",
"%d (km)",
"%d (m)",
"%d (mile)" },
new String[] { "m", "km", "mile" },
new String[] { "0", "1", "2", "3" },
"km", "1");
public static final Source PEDOMETER_SPEED = new Source("Speed", "stepsPerSec", 0.0D, 20.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d km/h",
"%d m/s",
"%d mile/h",
"%d (km/h)",
"%d (m/s)",
"%d (mile/h)" },
new String[] { "m/s", "km/h", "mile/h" },
new String[] { "0", "1", "2", "3" },
"km/h", "1");
public static final Source PEDOMETER_STEP_COUNT = new Source("Step counts", "pedometer.step", 0.0D, 10000.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d steps", "%d" });
public static final Source PEDOMETER_STEP_GOAL = new Source("Steps goal", "pedometer.target", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d steps", "%d" });
public static final Source PEDOMETER_FLOOR = new Source("Floor", "floor", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d floor", "%d" });
public static final Source HEARTRATE = new Source("Heart rate (bpm)", "heartrate.recent", 0.0D, 200.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d bpm", "%d" });
public static final Source WATER_INTAKE = new Source("Water Intake", "water", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d" });
public static final Source WATER_GOAL = new Source("Water Goal", "water.goal", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "%d" });
public static final Source CAFFEINE_INTAKE = new Source("Caffeine Intake", "caffeine", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/healthinfo", new String[] { "%d" });
public static final Source CAFFEINE_GOAL = new Source("Caffeine Goal", "caffeine.goal", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "%d" });
public static final Source ALARM_HOUR = new Source("Alarm hour", "alarm.hour0-23", 0.0D, 24.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/alarm.get", new String[] { "%d" });
public static final Source ALARM_MINUTE = new Source("Alarm minute", "alarm.minute", 0.0D, 60.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/alarm.get", new String[] { "%d" });
public static final Source ALARM_STATE = new Source("Alarm state", "alarm.state", 0.0D, 2.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/alarm.get", new String[] { "%d" });
public static final Source MOONPHASE_POSITION = new Source("Moon Phase Position", "moonphase.position", 0.0D, 28.0D, true, 0.0D, 360.0D,
null, new String[] { "%f" },
null,
new String[] { "0", "1", "2", "3", "4", "5" },
null, "0");
public static final Source MOONPHASE_TYPE = new Source("Moon Phase Type", "moonphase.type", 0.0D, 8.0D, false, 0.0D, 360.0D,
null, new String[] { "%d" });
public static final Source NOTIFICATION_UNREAD = new Source("Notification unread", "notification.unread", 0.0D, 100.0D, false, 0.0D, 360.0D,
"http://tizen.org/privilege/notification", new String[] { "%d" });
public static final Source WEATHER_TYPE = new Source("Weather Type", "Weather Type", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "Main",
"Icon",
"Description",
"Number",
"ID" });
public static final Source CURRENT_TEMPERATURE = new Source("Current Temperature", "Current Temperature", -50.0D, 50.0D, false, 0.0D, 360.0D,
null, new String[] { "%f �C",
"%f �F",
"%f �K",
"%f (�C)",
"%f (�F)",
"%f (�K)" },
new String[] { "�C", "�F", "�K" },
new String[] { "0", "1", "2", "3" },
"�C", "1");
public static final Source WEATHER_HUMIDITY = new Source("Weather Humidity", "Weather Humidity", 0.0D, 100.0D, false, 0.0D, 360.0D,
null,
new String[] { "%d %",
"%d (%)" },
new String[] { "%" },
new String[] { "0" },
"%", "0");
public static final Source WEATHER_CITY_NAME = new Source("City Name", "City Name", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "%d" });
public static final Source WEATHER_LAST_UPDATE_TIME = new Source("Last update Time", "Last update Time", 0.0D, 100.0D, false, 0.0D, 360.0D,
null, new String[] { "M/d HH:mm", "HH : mm" });
private static final HashMap<String, Source> map = new HashMap();
public final String name;
public final String id;
public double startValue;
public double endValue;
public boolean real;
public double startAngle;
public double endAngle;
public final String privilege;
public final String[] display;
public final String[] unit;
public final String[] precision;
public final String defaultUnit;
public final String defaultPrecision;
static
{
map.put(NONE.id, NONE);
map.put(HOUR_MINUTE.id, HOUR_MINUTE);
map.put(HOUR.id, HOUR);
map.put(MINUTE.id, MINUTE);
map.put(MINUTE_SECOND.id, MINUTE_SECOND);
map.put(SECOND.id, SECOND);
map.put(SECOND_SWEEP.id, SECOND_SWEEP);
map.put(DAY.id, DAY);
map.put(MONTH.id, MONTH);
map.put(DAY_OF_WEEK.id, DAY_OF_WEEK);
map.put(DAY_OF_YEAR.id, DAY_OF_YEAR);
map.put(BATTERY_PERCENT.id, BATTERY_PERCENT);
map.put(BATTERY_LEVEL.id, BATTERY_LEVEL);
map.put(BATTERY_CHARGING_STATUS.id, BATTERY_CHARGING_STATUS);
map.put(PEDOMETER_STEP_PERCENT.id, PEDOMETER_STEP_PERCENT);
map.put(PEDOMETER_CALORIE.id, PEDOMETER_CALORIE);
map.put(PEDOMETER_DISTANCE.id, PEDOMETER_DISTANCE);
map.put(PEDOMETER_SPEED.id, PEDOMETER_SPEED);
map.put(PEDOMETER_STEP_COUNT.id, PEDOMETER_STEP_COUNT);
map.put(PEDOMETER_STEP_GOAL.id, PEDOMETER_STEP_GOAL);
map.put(PEDOMETER_FLOOR.id, PEDOMETER_FLOOR);
map.put(HEARTRATE.id, HEARTRATE);
map.put(WATER_INTAKE.id, WATER_INTAKE);
map.put(WATER_GOAL.id, WATER_GOAL);
map.put(CAFFEINE_INTAKE.id, CAFFEINE_INTAKE);
map.put(CAFFEINE_GOAL.id, CAFFEINE_GOAL);
map.put(ALARM_HOUR.id, ALARM_HOUR);
map.put(ALARM_MINUTE.id, ALARM_MINUTE);
map.put(ALARM_STATE.id, ALARM_STATE);
map.put(MOONPHASE_POSITION.id, MOONPHASE_POSITION);
map.put(MOONPHASE_TYPE.id, MOONPHASE_TYPE);
map.put(NOTIFICATION_UNREAD.id, NOTIFICATION_UNREAD);
map.put(WEATHER_TYPE.id, WEATHER_TYPE);
map.put(CURRENT_TEMPERATURE.id, CURRENT_TEMPERATURE);
map.put(WEATHER_HUMIDITY.id, WEATHER_HUMIDITY);
map.put(WEATHER_CITY_NAME.id, WEATHER_CITY_NAME);
map.put(WEATHER_LAST_UPDATE_TIME.id, WEATHER_LAST_UPDATE_TIME);
map.put(NONE.name, NONE);
map.put(HOUR_MINUTE.name, HOUR_MINUTE);
map.put(HOUR.name, HOUR);
map.put(MINUTE.name, MINUTE);
map.put(MINUTE_SECOND.name, MINUTE_SECOND);
map.put(SECOND.name, SECOND);
map.put(SECOND_SWEEP.name, SECOND_SWEEP);
map.put(DAY.name, DAY);
map.put(MONTH.name, MONTH);
map.put(DAY_OF_WEEK.name, DAY_OF_WEEK);
map.put(DAY_OF_YEAR.name, DAY_OF_YEAR);
map.put(BATTERY_PERCENT.name, BATTERY_PERCENT);
map.put(BATTERY_LEVEL.name, BATTERY_LEVEL);
map.put(BATTERY_CHARGING_STATUS.name, BATTERY_CHARGING_STATUS);
map.put(PEDOMETER_STEP_PERCENT.name, PEDOMETER_STEP_PERCENT);
map.put(PEDOMETER_CALORIE.name, PEDOMETER_CALORIE);
map.put(PEDOMETER_DISTANCE.name, PEDOMETER_DISTANCE);
map.put(PEDOMETER_SPEED.name, PEDOMETER_SPEED);
map.put(PEDOMETER_STEP_COUNT.name, PEDOMETER_STEP_COUNT);
map.put(PEDOMETER_STEP_GOAL.name, PEDOMETER_STEP_GOAL);
map.put(PEDOMETER_FLOOR.name, PEDOMETER_FLOOR);
map.put(HEARTRATE.name, HEARTRATE);
map.put(WATER_INTAKE.name, WATER_INTAKE);
map.put(WATER_GOAL.name, WATER_GOAL);
map.put(CAFFEINE_INTAKE.name, CAFFEINE_INTAKE);
map.put(CAFFEINE_GOAL.name, CAFFEINE_GOAL);
map.put(ALARM_HOUR.name, ALARM_HOUR);
map.put(ALARM_MINUTE.name, ALARM_MINUTE);
map.put(ALARM_STATE.name, ALARM_STATE);
map.put(MOONPHASE_POSITION.name, MOONPHASE_POSITION);
map.put(MOONPHASE_TYPE.name, MOONPHASE_TYPE);
map.put(NOTIFICATION_UNREAD.name, NOTIFICATION_UNREAD);
map.put(WEATHER_TYPE.name, WEATHER_TYPE);
map.put(CURRENT_TEMPERATURE.name, CURRENT_TEMPERATURE);
map.put(WEATHER_HUMIDITY.name, WEATHER_HUMIDITY);
map.put(WEATHER_CITY_NAME.name, WEATHER_CITY_NAME);
map.put(WEATHER_LAST_UPDATE_TIME.name, WEATHER_LAST_UPDATE_TIME);
}
public Source(String name, String id, double startValue, double endValue, boolean real, double startAngle, double endAngle, String privilege, String[] display, String[] unit, String[] precision, String defaultUnit, String defaultPrecision)
{
this.name = name;
this.id = id;
this.startValue = startValue;
this.endValue = endValue;
this.real = real;
this.startAngle = startAngle;
this.endAngle = endAngle;
this.privilege = privilege;
this.display = display;
this.unit = unit;
this.precision = precision;
this.defaultUnit = defaultUnit;
this.defaultPrecision = defaultPrecision;
}
public Source(String name, String id, double startValue, double endValue, boolean real, double startAngle, double endAngle, String privilege, String[] display)
{
this(name, id, startValue, endValue, real, startAngle, endAngle, privilege, display, null, null, null, null);
}
public Source(Source source)
{
this(source.name, source.id, source.startValue, source.endValue, source.real, source.startAngle, source.endAngle, source.privilege, source.display, source.unit, source.precision, source.defaultUnit, source.defaultPrecision);
}
public boolean equals(Object obj)
{
if ((obj instanceof Source)) {
return (this.name.equals(((Source)obj).name)) && (this.id.equals(((Source)obj).id)) &&
(this.startValue == ((Source)obj).startValue) && (this.endValue == ((Source)obj).endValue) && (this.real == ((Source)obj).real) &&
(this.startAngle == ((Source)obj).startAngle) && (this.endAngle == ((Source)obj).endAngle);
}
return false;
}
public static Source findById(String id)
{
Source result = (Source)map.get(id);
if (result == null) {
return NONE;
}
return result;
}
public static Source findByName(String name)
{
return (Source)map.get(name);
}
}

Categories

Resources