Iconset for Day/Night - Zooper Widget General

Hey there!
I want to create a iconset which just shows a sun after sunrise and a moon(maybe with phases?), many iconsets support sun/moon, but I don't want to show the actual weather. I tried making my own icon set, but I can't find any good documentation for icon sets.
Anyone can help me with this?

Okay, I think I managed to do what I want now with this code, if anyone is curious:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
Weather conditions:
0 = UNKOWN
1 = STORM
2 = THUNDERSTORM
3 = DRIZZLE
4 = RAIN
5 = SHOWERS
6 = FLURRIES
7 = RAINANDSNOW
8 = SNOW
9 = HAIL
10 = FOG
11 = HAZE
12 = WIND
13 = PARTLY_CLOUDY
14 = MOSTLY_CLOUDY
15 = CLEAR
16 = FAIR
-->
<config>
<title>DayNight Icons</title>
<description>Icon indicator for Day and Night</description>
<icons>icons</icons>
<demo>sun.png</demo>
<default>sun.png</default>
<!-- We provide current and 2 days weather -->
<mode value="#WCCODE#">Change between Sun and Moon</mode>
<!-- Nightly icons block will be skipped entirely if his conditions do not match -->
<condition>
<!-- We just check if sunrise hour is greater than current -->
<test>#ARHH#>#DHH#</test>
<!-- Or if sunset if minor than current -->
<test>#ASHH#<#DHH#</test>
<condition>
<test>#MODE#=1</test>
<test>#MODE#=2</test>
<test>#MODE#=3</test>
<test>#MODE#=4</test>
<test>#MODE#=5</test>
<test>#MODE#=6</test>
<test>#MODE#=7</test>
<test>#MODE#=8</test>
<test>#MODE#=9</test>
<test>#MODE#=10</test>
<test>#MODE#=11</test>
<test>#MODE#=12</test>
<test>#MODE#=13</test>
<test>#MODE#=14</test>
<test>#MODE#=15</test>
<test>#MODE#=16</test>
<image>moon.png</image>
</condition>
<!-- Daily conditions (parser will arrive here if it did not catch anything in night block) -->
<condition>
<test>#MODE#=1</test>
<test>#MODE#=2</test>
<test>#MODE#=3</test>
<test>#MODE#=4</test>
<test>#MODE#=5</test>
<test>#MODE#=6</test>
<test>#MODE#=7</test>
<test>#MODE#=8</test>
<test>#MODE#=9</test>
<test>#MODE#=10</test>
<test>#MODE#=11</test>
<test>#MODE#=12</test>
<test>#MODE#=13</test>
<test>#MODE#=14</test>
<test>#MODE#=15</test>
<test>#MODE#=16</test>
<image>sun.png</image>
</condition>
</condition>
</config>
edit: Anybody knows, if it is possible to add moon states to this?

Related

Create PopUp with dimmed background

Hello devs
Im developing an application for Windows Mobile in Visual Basic.NET.
Now I would like to make some kind of PopUp with all the stuff seen in background "dimmed". This can be seen on all newer Manila-Style applications and of course HTC is making those popups.
But, how do I create such popups? I know that it has something to do with AlphaBlending, but I don't really understand how to make it.
Does anyone of you probably have a working sample solution in VB.NET?
Many thanks in advance for any help...
raftbone
Here you go. http://blogs.msdn.com/priozersk/archive/2009/03/31/dimming-the-background.aspx
This guys blog is great. All kinds of tips and tricks to make mobile apps work and look better.
Many thanks for the link. I'll try to get this code changed to VB.NET.
Seems to lock pretty easy and it's exactly what I was looking for
OK, I've managed to change the code into VB. This is the code:
Code:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim dimBackground As Bitmap = New Bitmap(Me.Width, Me.Height)
Dim gxTemp As Graphics = Graphics.FromImage(dimBackground)
gxTemp.Clear(Color.Black)
e.Graphics.drawalpha(dimBackground, 100, 0, 0)
gxTemp.Dispose()
dimBackground.Dispose()
End Sub
The code is working execpt "DrawAlpha". DrawAlpha seems to be unknown in VisualBasic.NET with .NET CF 3.5.
Can anyone help me how to get the DrawAlpha method working?
Code:
Public Module opacity
Public Structure BlendFunction
Public BlendOp As Byte
Public BlendFlags As Byte
Public SourceConstantAlpha As Byte
Public AlphaFormat As Byte
End Structure
Public Declare Function AlphaBlendCE Lib "Coredll.dll" Alias "AlphaBlend" (ByVal hdcDest As IntPtr, _
ByVal xDest As Int32, ByVal yDest As Int32, ByVal cxDest As Int32, _
ByVal cyDest As Int32, ByVal hdcSrc As IntPtr, ByVal xSrc As Int32, _
ByVal ySrc As Int32, ByVal cxSrc As Int32, ByVal cySrc As Int32, _
ByVal blendFunction As BlendFunction) As Int32
Public Enum BlendOperation As Byte
AC_SRC_OVER = &H0
End Enum
Public Enum BlendFlags As Byte
Zero = &H0
End Enum
Public Enum SourceConstantAlpha As Byte
Transparent = &H0
Opaque = &HFF
End Enum
Public Enum AlphaFormat As Byte
AC_SRC_ALPHA = &H0
End Enum
Public Sub DrawAlpha(ByVal gx As Graphics, ByVal image As Bitmap, _
ByVal transp As Byte, ByVal x As Integer, ByVal y As Integer)
Try
Using gxSrc As Graphics = Graphics.FromImage(image)
Dim hdcDst As IntPtr = gx.GetHdc()
Dim hdcSrc As IntPtr = gxSrc.GetHdc()
Dim bf As New BlendFunction()
bf.BlendOp = CByte(BlendOperation.AC_SRC_OVER)
bf.BlendFlags = CByte(BlendFlags.Zero)
bf.SourceConstantAlpha = transp
bf.AlphaFormat = CByte(AlphaFormat.AC_SRC_ALPHA)
AlphaBlendCE(hdcDst, x, y, image.Width, image.Height, hdcSrc, _
0, 0, image.Width, image.Height, bf)
gx.ReleaseHdc(hdcDst)
gxSrc.ReleaseHdc(hdcSrc)
End Using
Catch ex As Exception
Logger.log("Device dont support alphablending.", Logger.logLevel.NOTICE)
Logger.log(ex, Logger.logLevel.NOTICE)
End Try
End Sub
End Module
usage:
Code:
opacity.DrawAlpha(e.graphics, bmp, 128), 0, 0) 'draw your bmp with 50% opacity
Hope it help it's the quicker method that I found. I have cutted out some specific code from my app, so you ca find error, I've not test the code. Let me know if you have trouble.
If you are intrested there is an other way to make opacity bitmap that work pixel per pixel but is too slow.
If you found better method please post it.
Ciao
Hi
Many thanks for your code. It seems to work pretty using the code I have posted initally. There I was using a new form with WindowState = Maximized etc.
But now I don't really understand on how to exactly use your code in my project.
I have one form and multiple controls on it. The controls are normally invisible and set to Visible = True if I need to show them.
How can I now dim the background with your code, before setting a specific control to Visible = True?
I tried something like this:
Code:
Private Sub ShowPanel()
Dim dimBackground As Bitmap = New Bitmap(Me.Width, Me.Height)
Dim gxTemp As Graphics = Graphics.FromImage(dimBackground)
gxTemp.Clear(Color.Black)
modOpacity.DrawAlpha(gxTemp, dimBackground, 128, 0, 0)
gxTemp.Dispose()
dimBackground.Dispose()
Me.Panel2.Visible = True
End Sub
But if I do this code, I get an error in your code at the line:
Code:
Dim hdcSrc As IntPtr = gxSrc.GetHdc()
It seems, that the object gxSrc does not have a method GetHdc(), but I simply don't understand why...
Could you probably get me into the right direction?
raftbone
As explained in the blog I've created a form 'BackgroundForm'
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.Drawing;
namespace UI
{
public partial class BackgroundForm : Form
{
public BackgroundForm()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
using (Bitmap dimBackGround = new Bitmap(this.Width, this.Height))
using (Graphics gxTemp = Graphics.FromImage(dimBackGround))
{
gxTemp.Clear(Color.Black);
opacity.DrawAlpha(e.Graphics, dimBackGround, 100, 0, 0);
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
}
}
}
and changed it to be fullscreen (in the designer):
Code:
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
WindowState = System.Windows.Forms.FormWindowState.Maximized;
Then I've created a static helper class
Code:
using System;
using System.Windows.Forms;
namespace UI
{
public static class FormHelper
{
public static DialogResult ShowMessageBox(string text)
{
return ShowMessageBox(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult ShowMessageBox(string text, string caption)
{
return ShowMessageBox(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
}
public static DialogResult ShowMessageBox(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
BackgroundForm form = new BackgroundForm();
form.Show();
DialogResult result = MessageBox.Show(text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
form.Close();
return result;
}
}
}
And now you can simply use one of the three methods to show a message box with dimmed background e.g.
Code:
FormHelper.ShowMessageBox("Text", "Caption", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
To convert from C# to VB.net use for example convert csharp to vb.
Hi
Thanks for your answer. Meanwhile I was already able to get it working with your blog info about using a new form.
Thanks to everyone helping me
raftbone

WP7 - how to update the bound data in a chart?

Hi,
I'm having a hard time for, what I guess, is a simple question...
Here is the code I'm using to render the amChart
In short, my situation is tha the chart always renders the same datapoints...and there is no way I can change them!
Code:
Dim Y_Value_0 As Double = 0.0
Dim Y_Value_1 As Double = 0.0
Dim Y_Value_2 As Double = 0.0
Dim Y_Value_3 As Double = 0.0
Dim Y_Value_4 As Double = 0.0
Public Class ItemValues
Public Property Range() As String
Public Property Value() As Double
End Class
Private DataPoints As New ObservableCollection(Of ItemValues)() From
{New ItemValues() With {.Range = "200", .Value = Y_Value_0}, _
New ItemValues() With {.Range = "400", .Value = Y_Value_1}, _
New ItemValues() With {.Range = "600", .Value = Y_Value_2}, _
New ItemValues() With {.Range = "800", .Value = Y_Value_3}}
Public ReadOnly Property Data() As ObservableCollection(Of ItemValues)
Get
Return DataPoints
End Get
End Property
Private Sub Page_Graphs_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Me.Fill_Graph()
End Sub
Private Sub Fill_Graph()
Y_Value_0 = -5
Y_Value_1 = -10
Y_Value_2 = -20
Y_Value_3 = -50
Me.DataContext = Me
End Sub
However, there is no way, that when the chart is rendered it takes the new values...
In short, how to make the graph to take my data points?
Thanks in advance for any help!
You need to use INotifyPropertyChanged interface so the databound control knows when to update itself.
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx
Check out the "Windows Phone Databound Application" template installed by default if you want to see a working project. It uses a listbox but it's the same concept.

[Q] Iconset/XML Question

I'm working on a widget that will use the Media Utilities Current App variable (TMU_CURR_APP) to set an icon for that app. I'm fairly certain the problem is happening when I try to test for the value of #TMU_CURR_APP#. Is there a different operand I need to use to compare string values?
Thanks!
Code:
<config>
<title>MU Current App Icon</title>
<description>Media Utilities Current Application Playing</description>
<demo>music.png</demo>
<icons>icons</icons>
<default>music.png</default>
<condition>
<test>#TMU_CURR_APP#="Google Play Music"</test>
<image>playmusic.png</image>
</condition>
<condition>
<test>#TMU_CURR_APP#="BeyondPod"</test>
<image>rss.png</image>
</condition>
<condition>
<test>#TMU_CURR_APP#="Spotify"</test>
<image>spotify.png</image>
</condition>
</config>

[Q] Help with Iconset creation

Hi all,
I'm creating my first iconset for showing my mobile data consumption. I use the #NTMTMM# value that I compare to values from 0 Mb to 3000 Mb (my mobile contract limits my data to 3 Gb by month) with steps of 250 Mb.
The result is a circle with 12 steps from empty (all grey) to full (colored from green to red).
I have created a zip containing :
- config.xml
- folder icons that contains all my png files (stat_sys_data_0.png, stat_sys_data_1.png, ... ,stat_sys_data_12.png)
My config.xml contains :
Code:
<?xml version="1.0" encoding="utf-8"?>
<config>
<title>Mobile data Iconset</title>
<description>Created and packaged by E. Le Bourvellec. Based on a 3Gb data limit</description>
<demo>stat_sys_data_7.png</demo>
<icons>icons</icons>
<default>stat_sys_data_12.png</default>
<mode value="#NTMTMM#">Data use</mode>
<condition>
<test>#MODE#lt;=0</test>
<image>stat_sys_data_0.png</image>
</condition>
<condition>
<test>#MODE#lt;=250</test>
<image>stat_sys_data_1.png</image>
</condition>
<condition>
<test>#MODE#lt;=750</test>
<image>stat_sys_data_2.png</image>
</condition>
<condition>
<test>#MODE#lt;=1000</test>
<image>stat_sys_data_3.png</image>
</condition>
<condition>
<test>#MODE#lt;=1250</test>
<image>stat_sys_data_4.png</image>
</condition>
<condition>
<test>#MODE#lt;=1500</test>
<image>stat_sys_data_5.png</image>
</condition>
<condition>
<test>#MODE#lt;=1750</test>
<image>stat_sys_data_6.png</image>
</condition>
<condition>
<test>#MODE#lt;=2000</test>
<image>stat_sys_data_7.png</image>
</condition>
<condition>
<test>#MODE#lt;=2250</test>
<image>stat_sys_data_8.png</image>
</condition>
<condition>
<test>#MODE#lt;=2500</test>
<image>stat_sys_data_9.png</image>
</condition>
<condition>
<test>#MODE#lt;=2750</test>
<image>stat_sys_data_10.png</image>
</condition>
<condition>
<test>#MODE#lt;=3000</test>
<image>stat_sys_data_11.png</image>
</condition>
<condition>
<test>#MODE#gt;3000</test>
<image>stat_sys_data_12.png</image>
</condition>
</config>
My problem is that the zooper widget i create with that iconset always gives the "3 Gb" stat_sys_data_12.png image while it should show me the stat_sys_data_6.png image as i'm right now at about 1691 Mb (which is <= 1750 which indicates the stat_sys_data_6.png image).
I believe that my conditions are wrong somewhere but I don't see where.
Thanks in advance for your assistance
ps : i have put my zip file attached to this thread.
Eric
Wrong thread
Mokum020 said:
Shouldn't you ask this in the General section anyway, I think the only thing missing is the & symbol before the lt; and gt; operators, so it should be < and >
Here's a reference list: http://www.zooper.org/wp/android/zw/iconsets
I edited the xml file and attached it, should work now
Click to expand...
Click to collapse
Oh thank you, i had not seen that obvious mistake ...
ps : sorry if i put that thread in the wrong section

DO these brigtness settings in overlay look good?

Z, try this for z5p
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2009, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. Do not translate. -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
The N entries of this array define N 1 zones as follows:
Zone 0: 0 <= LUX < array[0]
Zone 1: array[0] <= LUX < array[1]
...
Zone N: array[N - 1] <= LUX < array[N]
Zone N + 1 array[N] <= LUX < infinity
Must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLevels">
<item>1</item>
<item>8</item>
<item>24</item>
<item>64</item>
<item>128</item>
<item>170</item>
<item>220</item>
<item>256</item>
<item>384</item>
<item>512</item>
<item>768</item>
<item>1024</item>
<item>1536</item>
<item>2048</item>
<item>2560</item>
<item>3584</item>
<item>4095</item>
</integer-array>
<!-- Array of output values for LCD backlight corresponding to the LUX values
in the config_autoBrightnessLevels array. This array should have size one greater
than the size of the config_autoBrightnessLevels array.
This must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>1</item> <!-- 0-8 -->
<item>2</item> <!-- 8-24 -->
<item>4</item> <!-- 24-64 -->
<item>8</item> <!-- 64-128 -->
<item>24</item> <!-- 128-170 -->
<item>32</item> <!-- 170-220 -->
<item>46</item> <!-- 220-256 -->
<item>65</item> <!-- 256-384 -->
<item>80</item> <!-- 384-512 -->
<item>100</item> <!-- 512-768 -->
<item>130</item> <!-- 768-1024 -->
<item>150</item> <!-- 1024-1536 -->
<item>170</item> <!-- 1536-2048 -->
<item>190</item> <!-- 2048-2560 -->
<item>220</item> <!-- 2560-3584 -->
<item>254</item> <!-- 3584-4094 -->
<item>255</item> <!-- 4095+ -->
</integer-array>
<!-- Array of output values for button backlight corresponding to the LUX values
in the config_autoBrightnessLevels array. This array should have size one greater
than the size of the config_autoBrightnessLevels array.
This must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessButtonBacklightValues" />
<!-- Minimum screen brightness setting allowed by the power manager.
The user is forbidden from setting the brightness below this level. -->
<integer name="config_screenBrightnessSettingMinimum">4</integer> <!-- 24 -->
<!-- Maximum screen brightness allowed by the power manager.
The user is forbidden from setting the brightness above this level. -->
<integer name="config_screenBrightnessSettingMaximum">255</integer> <!-- 4094 -->
<!-- Default screen brightness setting.
Must be in the range specified by minimum and maximum. -->
<integer name="config_screenBrightnessSettingDefault">170</integer> <!-- 2048 -->
<!-- Screen brightness used to dim the screen when the user activity
timeout expires. May be less than the minimum allowed brightness setting
that can be set by the user. -->
<integer name="config_screenBrightnessDim">4</integer> <!-- 24 -->
<!-- Screen brightness used to dim the screen while dozing in a very low power state.
May be less than the minimum allowed brightness setting
that can be set by the user. -->
<integer name="config_screenBrightnessDoze">1</integer> <!-- 8 -->
<!-- Minimum allowable screen brightness to use in a very dark room.
This value sets the floor for the darkest possible auto-brightness
adjustment. It is expected to be somewhat less than the first entry in
config_autoBrightnessLcdBacklightValues so as to allow the user to have
some range of adjustment to dim the screen further than usual in very
dark rooms. The contents of the screen must still be clearly visible
in darkness (although they may not be visible in a bright room). -->
<integer name="config_screenBrightnessDark">4</integer> <!-- 24 -->
<!-- Whether device supports double tap to wake -->
<bool name="config_supportDoubleTapWake">true</bool>
</resources>
my current settings
m

Categories

Resources