[TUT]Make your own watchface

Search This thread

julz

Senior Member
Mar 17, 2007
519
151
www.julianjwong.com
Dumb question - after you run the Android application via Eclipse and it installs the APK onto the phone, how do you view the watchface? Should it show as a new watchface clock in the customise watchface editor?

Edit: Answered my own question - yes :)
 
Last edited:

julz

Senior Member
Mar 17, 2007
519
151
www.julianjwong.com
Are you able to explain how to add a date to the analog clock (e.g. day of the month) and also maybe the month (e.g. Jul for July)

Thanks in advance!
 

julz

Senior Member
Mar 17, 2007
519
151
www.julianjwong.com

Hi Naheel,

I've tried adding the date but without any luck. Nothing is showing up on the watchface. Do I have to add some other code to include the new XML as part of the build? Will the date show above the watch background image or is there the chance that it is on the bottom layer? Also I'm guessing that the text will be white as per the sample code you posted. Any help is appreciated!
 

naheel azawy

Senior Member
Mar 10, 2012
627
962
27
doha/qatar
Hi Naheel,

I've tried adding the date but without any luck. Nothing is showing up on the watchface. Do I have to add some other code to include the new XML as part of the build? Will the date show above the watch background image or is there the chance that it is on the bottom layer? Also I'm guessing that the text will be white as per the sample code you posted. Any help is appreciated!

Sorry, I forget one last step.
edited :good:
 

julz

Senior Member
Mar 17, 2007
519
151
www.julianjwong.com
I've been busy making new analog watchfaces and figured out how to offset the dials. Edit the code within \res\layout\clock_widget_analog.xml

How to offset dials

As an example the following code will use a square second hands PNG file, resize it to 45x45px and offset it 82px from the top and 70px from the left. It will continue to rotate around the centre of the PNG file (i.e. around pixel x=23,y=23)
Code:
<include layout="@layout/analog_clock_hand_seconds"
        android:gravity="left"
        android:layout_marginTop="82px"
        android:layout_marginLeft="70px"
        android:layout_width="45px"
        android:layout_height="45px" 
        />
 

naheel azawy

Senior Member
Mar 10, 2012
627
962
27
doha/qatar
I've been busy making new analog watchfaces and figured out how to offset the dials. Edit the code within \res\layout\clock_widget_analog.xml

How to offset dials

As an example the following code will use a square second hands PNG file, resize it to 45x45px and offset it 82px from the top and 70px from the left. It will continue to rotate around the centre of the PNG file (i.e. around pixel x=23,y=23)
Code:
<include layout="@layout/analog_clock_hand_seconds"
        android:gravity="left"
        android:layout_marginTop="82px"
        android:layout_marginLeft="70px"
        android:layout_width="45px"
        android:layout_height="45px" 
        />

good notice :good:
also you can do that on the "analog_clock_hand_seconds.xml" it self.

Coming soon;
11.png
 

julz

Senior Member
Mar 17, 2007
519
151
www.julianjwong.com
Hi Naheel,

I've found a slight bug in the 'date' code you've shared. It cuts off the second digit for double-digit dates for some reason. For the moment I've only found an inelegant hackers way to fix the problem so I won't share my solution. Not sure if you have a better way of fixing it?

Cheers,
Julian
 

naheel azawy

Senior Member
Mar 10, 2012
627
962
27
doha/qatar
Hi Naheel,

I've found a slight bug in the 'date' code you've shared. It cuts off the second digit for double-digit dates for some reason. For the moment I've only found an inelegant hackers way to fix the problem so I won't share my solution. Not sure if you have a better way of fixing it?

Cheers,
Julian

this happen cuz you must add this:
Code:
widgets:template="dd"
and that cause the bug on some devices of showing "00" instead of the real date

also I have another way that I'll try:

Code:
<com.sonyericsson.extras.liveware.aef.widget.TimeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center" >

        <com.sonyericsson.extras.liveware.aef.widget.TimeView
            android:layout_width="25px"
            android:layout_height="20px"
            android:gravity="center"
            android:includeFontPadding="false"
            android:textColor="@android:color/black"
            widgets:textSize="20px"
            widgets:timeType="[COLOR="Red"]days_of_month_digit1[/COLOR]" />
        
        <com.sonyericsson.extras.liveware.aef.widget.TimeView
            android:layout_width="25px"
            android:layout_height="20px"
            android:gravity="center"
            android:includeFontPadding="false"
            android:textColor="@android:color/black"
            widgets:textSize="20px"
            widgets:timeType="[COLOR="Red"]days_of_month_digit2[/COLOR]" />
    </com.sonyericsson.extras.liveware.aef.widget.TimeLayout>
 

Ally153

Senior Member
Dec 26, 2007
57
1
Great tutorial :).

Has anyone tried to create a watchface using a string level-list? The Sony clock tutorial implies you can create a levelist a little like:

Code:
<?xml version="1.0" encoding="utf-8"?>

<!-- Defines the most significant minute number using a level-list of drawables
that can be referenced when creating clocks. -->

<level-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:string="@string/min_digit_0" />
    ...
</level-list>

However, Eclipse will throw an error with the use of "android:string". I have tried saving the above XML in the drawable-nodpi folder and had added the appropriate string entries in the strings.xml file.

Any ideas?
 

ceeso

Member
Jul 11, 2008
8
2
Again many thanks for your detailed tutorial, Naheel!

Here is my cyan watchface (2 included)

edit: updated apk to Naheels slim version, thanks :good:
 

Attachments

  • Preview.jpg
    Preview.jpg
    46.5 KB · Views: 432
  • ClockWidgetCyan.apk
    139.2 KB · Views: 3,709
Last edited:
  • Like
Reactions: naheel azawy

naheel azawy

Senior Member
Mar 10, 2012
627
962
27
doha/qatar
Great tutorial :).

Has anyone tried to create a watchface using a string level-list? The Sony clock tutorial implies you can create a levelist a little like:

Code:
<?xml version="1.0" encoding="utf-8"?>

<!-- Defines the most significant minute number using a level-list of drawables
that can be referenced when creating clocks. -->

<level-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:string="@string/min_digit_0" />
    ...
</level-list>

However, Eclipse will throw an error with the use of "android:string". I have tried saving the above XML in the drawable-nodpi folder and had added the appropriate string entries in the strings.xml file.

Any ideas?

I tried to make this in drawable:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Defines the least significant hour number using a level-list of drawables
that can be referenced when creating clocks. -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:text="one" android:textSize="20px" />
    <item android:text="two" android:textSize="20px" />
    <item android:text="three" android:textSize="20px" />
    <item android:text="four" android:textSize="20px" />
    <item android:text="five" android:textSize="20px" />
    <item android:text="six" android:textSize="20px" />
    <item android:text="seven" android:textSize="20px" />
    <item android:text="eight" android:textSize="20px" />
    <item android:text="nine" android:textSize="20px" />
    <item android:text="ten" android:textSize="20px" />
    <item android:text="eleven" android:textSize="20px" />
    <item android:text="twelve" android:textSize="20px" />
</level-list>

that had to be the hours but it didn't worked on the watch.
however, you can write what ever you want on png files and use it as a level list
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Who wanted an LCARS styled clock?

    lcars_preview.png


    Download from Google Play
    5
    I've been busy making new analog watchfaces and figured out how to offset the dials. Edit the code within \res\layout\clock_widget_analog.xml

    How to offset dials

    As an example the following code will use a square second hands PNG file, resize it to 45x45px and offset it 82px from the top and 70px from the left. It will continue to rotate around the centre of the PNG file (i.e. around pixel x=23,y=23)
    Code:
    <include layout="@layout/analog_clock_hand_seconds"
            android:gravity="left"
            android:layout_marginTop="82px"
            android:layout_marginLeft="70px"
            android:layout_width="45px"
            android:layout_height="45px" 
            />

    good notice :good:
    also you can do that on the "analog_clock_hand_seconds.xml" it self.

    Coming soon;
    11.png
    3
    Sorry for my late answer, I just came back to home.
    Welcome back :)

    I'm not yet really happy with them, but here you are my first watchfaces. They are related to Ingress (game logo, Resistance faction logo, Enlightened faction logo), the only game I play.

    ingress_watchfaces.png
    3
    black and white analog examples

    Hello all,
    Here enclosed is what I have made for my sw2. My contribution is minimal, just followed Naheel's guide.