Browse files

Added ability to remove Weather line.

  • Loading branch information...
1 parent f92264d commit d1fa1d71c17802fa7b6e60086f7fa59521d364af @Pedlar Pedlar committed Oct 22, 2011
View
BIN assets/Thumbs.db
Binary file not shown.
View
6 res/layout/settings.xml
@@ -188,6 +188,12 @@
android:defaultValue="5"
/>
<CheckBoxPreference
+ android:title="Disable Weather"
+ android:key="DisableWeather"
+ android:summary="Disable weaather on idle screen"
+ android:defaultValue="false"
+ />
+ <CheckBoxPreference
android:title="Music Controls (Beta)"
android:key="IdleMusicControls"
android:summary="Enable music controls on Idle screen"
View
55 src/org/metawatch/manager/Idle.java
@@ -32,6 +32,7 @@
package org.metawatch.manager;
+import org.metawatch.manager.MetaWatchService.Preferences;
import org.metawatch.manager.Monitors.WeatherData;
import android.content.Context;
@@ -67,30 +68,30 @@ static Bitmap createLcdIdle(Context context) {
canvas.drawColor(Color.WHITE);
canvas = drawLine(canvas, 32);
-
- if (WeatherData.received) {
- // condition
- canvas.save();
- TextPaint paint = new TextPaint(paintSmall);
- StaticLayout layout = new StaticLayout(WeatherData.condition, paint, 36, android.text.Layout.Alignment.ALIGN_NORMAL, 1.3f, 0, false);
- canvas.translate(3, 40); //position the text
- layout.draw(canvas);
- canvas.restore();
+ if(!Preferences.disableWeather) {
+ if (WeatherData.received) {
+ // condition
+ canvas.save();
+ TextPaint paint = new TextPaint(paintSmall);
+ StaticLayout layout = new StaticLayout(WeatherData.condition, paint, 36, android.text.Layout.Alignment.ALIGN_NORMAL, 1.3f, 0, false);
+ canvas.translate(3, 40); //position the text
+ layout.draw(canvas);
+ canvas.restore();
- // icon
- Bitmap image = Utils.loadBitmapFromAssets(context, WeatherData.icon);
- canvas.drawBitmap(image, 38, 37, null);
+ // icon
+ Bitmap image = Utils.loadBitmapFromAssets(context, WeatherData.icon);
+ canvas.drawBitmap(image, 38, 37, null);
- // temperatures
- canvas.drawText(WeatherData.temp, 64, 46, paintLarge);
- canvas.drawText(WeatherData.tempHigh, 64, 54, paintSmall);
- canvas.drawText(WeatherData.tempLow, 64, 62, paintSmall);
- } else {
- canvas.drawText("no data", 34, 50, paintSmall);
+ // temperatures
+ canvas.drawText(WeatherData.temp, 64, 46, paintLarge);
+ canvas.drawText(WeatherData.tempHigh, 64, 54, paintSmall);
+ canvas.drawText(WeatherData.tempLow, 64, 62, paintSmall);
+ } else {
+ canvas.drawText("no data", 34, 50, paintSmall);
+ }
+ canvas = drawLine(canvas, 64);
}
- canvas = drawLine(canvas, 64);
-
// icons row
//Bitmap imageI = Utils.loadBitmapFromAssets(context, "idle_icons_row.bmp");
//canvas.drawBitmap(imageI, 0, 66, null);
@@ -102,21 +103,21 @@ static Bitmap createLcdIdle(Context context) {
else
rows = 2;
*/
-
+ int yPos = !Preferences.disableWeather ? 67 : 36;
// icons
for (int i = 0; i < rows; i++) {
int slotSpace = 96/rows;
int slotX = slotSpace/2-12;
int iconX = slotSpace*i + slotX;
switch (i) {
case 0:
- canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_call.bmp"), iconX, 67, null);
+ canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_call.bmp"), iconX, yPos, null);
break;
case 1:
- canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_sms.bmp"), iconX, 67, null);
+ canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_sms.bmp"), iconX, yPos, null);
break;
case 2:
- canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_gmail.bmp"), iconX, 67, null);
+ canvas.drawBitmap(Utils.loadBitmapFromAssets(context, "idle_gmail.bmp"), iconX, yPos, null);
break;
}
}
@@ -145,7 +146,11 @@ static Bitmap createLcdIdle(Context context) {
int slotX = (int) (slotSpace/2-paintSmall.measureText(count)/2);
int countX = slotSpace*i + slotX;
- canvas.drawText(count, countX, 92, paintSmall);
+ canvas.drawText(count, countX, !Preferences.disableWeather ? 92 : 62, paintSmall);
+ }
+ if(Preferences.disableWeather) {
+ canvas = drawLine(canvas, 64);
+ //Add more icons here in future.
}
/*
View
2 src/org/metawatch/manager/MetaWatchService.java
@@ -138,6 +138,7 @@
public static boolean idleMusicControls = false;
public static boolean idleReplay = false;
public static boolean pauseBeforeScrolling = false;
+ public static boolean disableWeather = false;
}
final class WatchType {
@@ -169,6 +170,7 @@ public static void loadPreferences(Context context) {
Preferences.idleMusicControls = sharedPreferences.getBoolean("IdleMusicControls", Preferences.idleMusicControls);
Preferences.idleReplay = sharedPreferences.getBoolean("IdleReplay", Preferences.idleReplay);
Preferences.pauseBeforeScrolling = sharedPreferences.getBoolean("pauseBeforeScrolling", Preferences.pauseBeforeScrolling);
+ Preferences.disableWeather = sharedPreferences.getBoolean("DisableWeather", Preferences.disableWeather);
try {
Preferences.fontSize = Integer.valueOf(sharedPreferences.getString("FontSize", Integer.toString(Preferences.fontSize)));

0 comments on commit d1fa1d7

Please sign in to comment.