DeskClock.java revision 4dc051aa9b76d8dffbd2372740eff2735c654540
1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.deskclock;
18
19import android.app.Activity;
20import android.app.AlertDialog;
21import android.content.BroadcastReceiver;
22import android.content.Context;
23import android.content.DialogInterface;
24import android.content.Intent;
25import android.content.IntentFilter;
26import android.content.SharedPreferences;
27import android.content.pm.PackageManager;
28import android.content.res.Configuration;
29import android.content.res.Resources;
30import android.database.Cursor;
31import android.graphics.drawable.BitmapDrawable;
32import android.graphics.drawable.ColorDrawable;
33import android.graphics.drawable.Drawable;
34import android.net.Uri;
35import android.os.Bundle;
36import android.os.Handler;
37import android.os.Message;
38import android.os.SystemClock;
39import android.os.PowerManager;
40import android.provider.Settings;
41import android.text.TextUtils;
42import android.util.DisplayMetrics;
43import android.util.Log;
44import android.view.ContextMenu.ContextMenuInfo;
45import android.view.ContextMenu;
46import android.view.LayoutInflater;
47import android.view.Menu;
48import android.view.MenuItem;
49import android.view.View.OnClickListener;
50import android.view.View.OnCreateContextMenuListener;
51import android.view.View;
52import android.view.ViewGroup;
53import android.view.Window;
54import android.view.WindowManager;
55import android.view.animation.Animation;
56import android.view.animation.AnimationUtils;
57import android.view.animation.TranslateAnimation;
58import android.widget.AbsoluteLayout;
59import android.widget.AdapterView.AdapterContextMenuInfo;
60import android.widget.AdapterView.OnItemClickListener;
61import android.widget.AdapterView;
62import android.widget.Button;
63import android.widget.CheckBox;
64import android.widget.ImageView;
65import android.widget.TextView;
66
67import static android.os.BatteryManager.BATTERY_STATUS_CHARGING;
68import static android.os.BatteryManager.BATTERY_STATUS_FULL;
69import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
70
71import java.io.IOException;
72import java.io.InputStream;
73import java.text.DateFormat;
74import java.util.Date;
75import java.util.Locale;
76import java.util.Random;
77
78/**
79 * DeskClock clock view for desk docks.
80 */
81public class DeskClock extends Activity {
82    private static final boolean DEBUG = false;
83
84    private static final String LOG_TAG = "DeskClock";
85
86    // Intent used to start the music player.
87    private static final String MUSIC_NOW_PLAYING = "com.android.music.PLAYBACK_VIEWER";
88
89    // Interval between polls of the weather widget. Its refresh period is
90    // likely to be much longer (~3h), but we want to pick up any changes
91    // within 5 minutes.
92    private final long FETCH_WEATHER_DELAY = 5 * 60 * 1000; // 5 min
93
94    // Delay before engaging the burn-in protection mode (green-on-black).
95    private final long SCREEN_SAVER_TIMEOUT = 10 * 60 * 1000; // 10 min
96
97    // Repositioning delay in screen saver.
98    private final long SCREEN_SAVER_MOVE_DELAY = 60 * 1000; // 1 min
99
100    // Color to use for text & graphics in screen saver mode.
101    private final int SCREEN_SAVER_COLOR = 0xFF008000;
102    private final int SCREEN_SAVER_COLOR_DIM = 0xFF003000;
103
104    // Internal message IDs.
105    private final int FETCH_WEATHER_DATA_MSG     = 0x1000;
106    private final int UPDATE_WEATHER_DISPLAY_MSG = 0x1001;
107    private final int SCREEN_SAVER_TIMEOUT_MSG   = 0x2000;
108    private final int SCREEN_SAVER_MOVE_MSG      = 0x2001;
109
110    // Weather widget query information.
111    private static final String GENIE_PACKAGE_ID = "com.google.android.apps.genie.geniewidget";
112    private static final String WEATHER_CONTENT_AUTHORITY = GENIE_PACKAGE_ID + ".weather";
113    private static final String WEATHER_CONTENT_PATH = "/weather/current";
114    private static final String[] WEATHER_CONTENT_COLUMNS = new String[] {
115            "location",
116            "timestamp",
117            "highTemperature",
118            "lowTemperature",
119            "iconUrl",
120            "iconResId",
121            "description",
122        };
123
124    // State variables follow.
125    private DigitalClock mTime;
126    private TextView mDate;
127
128    private TextView mNextAlarm = null;
129    private TextView mBatteryDisplay;
130
131    private TextView mWeatherHighTemperature;
132    private TextView mWeatherLowTemperature;
133    private TextView mWeatherLocation;
134    private ImageView mWeatherIcon;
135
136    private String mWeatherHighTemperatureString;
137    private String mWeatherLowTemperatureString;
138    private String mWeatherLocationString;
139    private Drawable mWeatherIconDrawable;
140
141    private Resources mGenieResources = null;
142
143    private boolean mDimmed = false;
144    private boolean mScreenSaverMode = false;
145
146    private DateFormat mDateFormat;
147
148    private int mBatteryLevel = -1;
149    private boolean mPluggedIn = false;
150
151    private int mIdleTimeoutEpoch = 0;
152
153    private boolean mWeatherFetchScheduled = false;
154
155    private Random mRNG;
156
157    private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
158        @Override
159        public void onReceive(Context context, Intent intent) {
160            final String action = intent.getAction();
161            if (Intent.ACTION_DATE_CHANGED.equals(action)) {
162                refreshDate();
163            } else if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
164                handleBatteryUpdate(
165                    intent.getIntExtra("status", BATTERY_STATUS_UNKNOWN),
166                    intent.getIntExtra("level", 0));
167            }
168        }
169    };
170
171    private final Handler mHandy = new Handler() {
172        @Override
173        public void handleMessage(Message m) {
174            if (m.what == FETCH_WEATHER_DATA_MSG) {
175                if (!mWeatherFetchScheduled) return;
176                mWeatherFetchScheduled = false;
177                new Thread() { public void run() { fetchWeatherData(); } }.start();
178                scheduleWeatherFetchDelayed(FETCH_WEATHER_DELAY);
179            } else if (m.what == UPDATE_WEATHER_DISPLAY_MSG) {
180                updateWeatherDisplay();
181            } else if (m.what == SCREEN_SAVER_TIMEOUT_MSG) {
182                if (m.arg1 == mIdleTimeoutEpoch) {
183                    saveScreen();
184                }
185            } else if (m.what == SCREEN_SAVER_MOVE_MSG) {
186                moveScreenSaver();
187            }
188        }
189    };
190
191
192    private void moveScreenSaver() {
193        moveScreenSaverTo(-1,-1);
194    }
195    private void moveScreenSaverTo(int x, int y) {
196        if (!mScreenSaverMode) return;
197
198        final View time_date = findViewById(R.id.time_date);
199
200        /*
201        final TranslateAnimation anim = new TranslateAnimation(
202            Animation.RELATIVE_TO_SELF,   0, // fromX
203            Animation.RELATIVE_TO_PARENT, 0.5f, // toX
204            Animation.RELATIVE_TO_SELF,   0, // fromY
205            Animation.RELATIVE_TO_PARENT, 0.5f // toY
206        );
207        anim.setDuration(1000);
208        anim.setInterpolator(new android.view.animation.AccelerateDecelerateInterpolator());
209        anim.setFillEnabled(true);
210        anim.setFillAfter(true);
211        time_date.startAnimation(anim);
212        */
213
214        DisplayMetrics metrics = new DisplayMetrics();
215        getWindowManager().getDefaultDisplay().getMetrics(metrics);
216
217        if (x < 0 || y < 0) {
218            int myWidth = time_date.getMeasuredWidth();
219            int myHeight = time_date.getMeasuredHeight();
220            x = (int)(mRNG.nextFloat()*(metrics.widthPixels - myWidth));
221            y = (int)(mRNG.nextFloat()*(metrics.heightPixels - myHeight));
222        }
223
224        if (DEBUG) Log.d(LOG_TAG, String.format("screen saver: %d: jumping to (%d,%d)",
225                System.currentTimeMillis(), x, y));
226
227        time_date.setLayoutParams(new AbsoluteLayout.LayoutParams(
228            ViewGroup.LayoutParams.WRAP_CONTENT,
229            ViewGroup.LayoutParams.WRAP_CONTENT,
230            x,
231            y));
232
233        // Synchronize our jumping so that it happens exactly on the second.
234        mHandy.sendEmptyMessageDelayed(SCREEN_SAVER_MOVE_MSG,
235            SCREEN_SAVER_MOVE_DELAY +
236            (1000 - (System.currentTimeMillis() % 1000)));
237    }
238
239    private void setWakeLock(boolean hold) {
240        if (DEBUG) Log.d(LOG_TAG, (hold ? "hold" : " releas") + "ing wake lock");
241        Window win = getWindow();
242        WindowManager.LayoutParams winParams = win.getAttributes();
243        winParams.flags |= WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
244        winParams.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
245        winParams.flags |= WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
246        if (hold)
247            winParams.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
248        else
249            winParams.flags &= (~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
250        win.setAttributes(winParams);
251    }
252
253    private void restoreScreen() {
254        if (!mScreenSaverMode) return;
255        if (DEBUG) Log.d(LOG_TAG, "restoreScreen");
256        mScreenSaverMode = false;
257        initViews();
258        doDim(false); // restores previous dim mode
259        refreshAll();
260    }
261
262    // Special screen-saver mode for OLED displays that burn in quickly
263    private void saveScreen() {
264        if (mScreenSaverMode) return;
265        if (DEBUG) Log.d(LOG_TAG, "saveScreen");
266
267        // quickly stash away the x/y of the current date
268        final View oldTimeDate = findViewById(R.id.time_date);
269        int oldLoc[] = new int[2];
270        oldTimeDate.getLocationOnScreen(oldLoc);
271
272        mScreenSaverMode = true;
273        Window win = getWindow();
274        WindowManager.LayoutParams winParams = win.getAttributes();
275        winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
276        win.setAttributes(winParams);
277
278        // give up any internal focus before we switch layouts
279        final View focused = getCurrentFocus();
280        if (focused != null) focused.clearFocus();
281
282        setContentView(R.layout.desk_clock_saver);
283
284        mTime = (DigitalClock) findViewById(R.id.time);
285        mDate = (TextView) findViewById(R.id.date);
286
287        final int color = mDimmed ? SCREEN_SAVER_COLOR_DIM : SCREEN_SAVER_COLOR;
288
289        ((TextView)findViewById(R.id.timeDisplay)).setTextColor(color);
290        ((TextView)findViewById(R.id.am_pm)).setTextColor(color);
291        mDate.setTextColor(color);
292
293        mBatteryDisplay =
294        mNextAlarm =
295        mWeatherHighTemperature =
296        mWeatherLowTemperature =
297        mWeatherLocation = null;
298        mWeatherIcon = null;
299
300        refreshDate();
301
302        moveScreenSaverTo(oldLoc[0], oldLoc[1]);
303    }
304
305    @Override
306    public void onUserInteraction() {
307        if (mScreenSaverMode)
308            restoreScreen();
309    }
310
311    private boolean supportsWeather() {
312        return (mGenieResources != null);
313    }
314
315    private void scheduleWeatherFetchDelayed(long delay) {
316        if (mWeatherFetchScheduled) return;
317
318        if (DEBUG) Log.d(LOG_TAG, "scheduling weather fetch message for " + delay + "ms from now");
319
320        mWeatherFetchScheduled = true;
321
322        mHandy.sendEmptyMessageDelayed(FETCH_WEATHER_DATA_MSG, delay);
323    }
324
325    private void unscheduleWeatherFetch() {
326        mWeatherFetchScheduled = false;
327    }
328
329    private static final boolean sCelsius;
330    static {
331        String cc = Locale.getDefault().getCountry().toLowerCase();
332        sCelsius = !("us".equals(cc) || "bz".equals(cc) || "jm".equals(cc));
333    }
334
335    private static int celsiusToLocal(int tempC) {
336        return sCelsius ? tempC : (int) Math.round(tempC * 1.8f + 32);
337    }
338
339    private void fetchWeatherData() {
340        // if we couldn't load the weather widget's resources, we simply
341        // assume it's not present on the device.
342        if (mGenieResources == null) return;
343
344        Uri queryUri = new Uri.Builder()
345            .scheme(android.content.ContentResolver.SCHEME_CONTENT)
346            .authority(WEATHER_CONTENT_AUTHORITY)
347            .path(WEATHER_CONTENT_PATH)
348            .appendPath(new Long(System.currentTimeMillis()).toString())
349            .build();
350
351        if (DEBUG) Log.d(LOG_TAG, "querying genie: " + queryUri);
352
353        Cursor cur;
354        try {
355            cur = managedQuery(
356                queryUri,
357                WEATHER_CONTENT_COLUMNS,
358                null,
359                null,
360                null);
361        } catch (RuntimeException e) {
362            Log.e(LOG_TAG, "Weather query failed", e);
363            cur = null;
364        }
365
366        if (cur != null && cur.moveToFirst()) {
367            if (DEBUG) {
368                java.lang.StringBuilder sb =
369                    new java.lang.StringBuilder("Weather query result: {");
370                for(int i=0; i<cur.getColumnCount(); i++) {
371                    if (i>0) sb.append(", ");
372                    sb.append(cur.getColumnName(i))
373                        .append("=")
374                        .append(cur.getString(i));
375                }
376                sb.append("}");
377                Log.d(LOG_TAG, sb.toString());
378            }
379
380            mWeatherIconDrawable = mGenieResources.getDrawable(cur.getInt(
381                cur.getColumnIndexOrThrow("iconResId")));
382            mWeatherHighTemperatureString = String.format("%d\u00b0",
383                celsiusToLocal(cur.getInt(cur.getColumnIndexOrThrow("highTemperature"))));
384            mWeatherLowTemperatureString = String.format("%d\u00b0",
385                celsiusToLocal(cur.getInt(cur.getColumnIndexOrThrow("lowTemperature"))));
386            mWeatherLocationString = cur.getString(
387                cur.getColumnIndexOrThrow("location"));
388        } else {
389            Log.w(LOG_TAG, "No weather information available (cur="
390                + cur +")");
391            mWeatherIconDrawable = null;
392            mWeatherHighTemperatureString = "";
393            mWeatherLowTemperatureString = "";
394            mWeatherLocationString = "Weather data unavailable."; // TODO: internationalize
395        }
396
397        mHandy.sendEmptyMessage(UPDATE_WEATHER_DISPLAY_MSG);
398    }
399
400    private void refreshWeather() {
401        if (supportsWeather())
402            scheduleWeatherFetchDelayed(0);
403        updateWeatherDisplay(); // in case we have it cached
404    }
405
406    private void updateWeatherDisplay() {
407        if (mWeatherHighTemperature == null) return;
408
409        mWeatherHighTemperature.setText(mWeatherHighTemperatureString);
410        mWeatherLowTemperature.setText(mWeatherLowTemperatureString);
411        mWeatherLocation.setText(mWeatherLocationString);
412        mWeatherIcon.setImageDrawable(mWeatherIconDrawable);
413    }
414
415    // Adapted from KeyguardUpdateMonitor.java
416    private void handleBatteryUpdate(int plugStatus, int batteryLevel) {
417        final boolean pluggedIn = (plugStatus == BATTERY_STATUS_CHARGING || plugStatus == BATTERY_STATUS_FULL);
418        if (pluggedIn != mPluggedIn) {
419            setWakeLock(pluggedIn);
420        }
421        if (pluggedIn != mPluggedIn || batteryLevel != mBatteryLevel) {
422            mBatteryLevel = batteryLevel;
423            mPluggedIn = pluggedIn;
424            refreshBattery();
425        }
426    }
427
428    private void refreshBattery() {
429        if (mBatteryDisplay == null) return;
430
431        if (mPluggedIn /* || mBatteryLevel < LOW_BATTERY_THRESHOLD */) {
432            mBatteryDisplay.setCompoundDrawablesWithIntrinsicBounds(
433                0, 0, android.R.drawable.ic_lock_idle_charging, 0);
434            mBatteryDisplay.setText(
435                getString(R.string.battery_charging_level, mBatteryLevel));
436            mBatteryDisplay.setVisibility(View.VISIBLE);
437        } else {
438            mBatteryDisplay.setVisibility(View.INVISIBLE);
439        }
440    }
441
442    private void refreshDate() {
443        mDate.setText(mDateFormat.format(new Date()));
444    }
445
446    private void refreshAlarm() {
447        if (mNextAlarm == null) return;
448
449        String nextAlarm = Settings.System.getString(getContentResolver(),
450                Settings.System.NEXT_ALARM_FORMATTED);
451        if (!TextUtils.isEmpty(nextAlarm)) {
452            mNextAlarm.setText(nextAlarm);
453            //mNextAlarm.setCompoundDrawablesWithIntrinsicBounds(
454            //    android.R.drawable.ic_lock_idle_alarm, 0, 0, 0);
455            mNextAlarm.setVisibility(View.VISIBLE);
456        } else {
457            mNextAlarm.setVisibility(View.INVISIBLE);
458        }
459    }
460
461    private void refreshAll() {
462        refreshDate();
463        refreshAlarm();
464        refreshBattery();
465        refreshWeather();
466    }
467
468    private void doDim(boolean fade) {
469        View tintView = findViewById(R.id.window_tint);
470        if (tintView == null) return;
471
472        Window win = getWindow();
473        WindowManager.LayoutParams winParams = win.getAttributes();
474
475        // secret!
476        winParams.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
477        winParams.flags |= (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
478
479        // dim the wallpaper somewhat (how much is determined below)
480        winParams.flags |= (WindowManager.LayoutParams.FLAG_DIM_BEHIND);
481
482        if (mDimmed) {
483            winParams.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
484            winParams.dimAmount = 0.5f; // pump up contrast in dim mode
485
486            // show the window tint
487            tintView.startAnimation(AnimationUtils.loadAnimation(this,
488                fade ? R.anim.dim
489                     : R.anim.dim_instant));
490        } else {
491            winParams.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
492            winParams.dimAmount = 0.2f; // lower contrast in normal mode
493
494            // hide the window tint
495            tintView.startAnimation(AnimationUtils.loadAnimation(this,
496                fade ? R.anim.undim
497                     : R.anim.undim_instant));
498        }
499
500        win.setAttributes(winParams);
501    }
502
503    @Override
504    public void onResume() {
505        super.onResume();
506        if (DEBUG) Log.d(LOG_TAG, "onResume");
507
508        // reload the date format in case the user has changed settings
509        // recently
510        mDateFormat = java.text.DateFormat.getDateInstance(java.text.DateFormat.FULL);
511
512        IntentFilter filter = new IntentFilter();
513        filter.addAction(Intent.ACTION_DATE_CHANGED);
514        filter.addAction(Intent.ACTION_BATTERY_CHANGED);
515        registerReceiver(mIntentReceiver, filter);
516
517        doDim(false);
518        restoreScreen();
519        refreshAll(); // will schedule periodic weather fetch
520
521        setWakeLock(mPluggedIn);
522
523        mIdleTimeoutEpoch++;
524        mHandy.sendMessageDelayed(
525            Message.obtain(mHandy, SCREEN_SAVER_TIMEOUT_MSG, mIdleTimeoutEpoch, 0),
526            SCREEN_SAVER_TIMEOUT);
527    }
528
529    @Override
530    public void onPause() {
531        if (DEBUG) Log.d(LOG_TAG, "onPause");
532
533        // Turn off the screen saver.
534        restoreScreen();
535
536        // Avoid situations where the user launches Alarm Clock and is
537        // surprised to find it in dim mode (because it was last used in dim
538        // mode, but that last use is long in the past).
539        mDimmed = false;
540
541        // Other things we don't want to be doing in the background.
542        unregisterReceiver(mIntentReceiver);
543        unscheduleWeatherFetch();
544
545        super.onPause();
546    }
547
548
549    private void initViews() {
550        // give up any internal focus before we switch layouts
551        final View focused = getCurrentFocus();
552        if (focused != null) focused.clearFocus();
553
554        setContentView(R.layout.desk_clock);
555
556        mTime = (DigitalClock) findViewById(R.id.time);
557        mDate = (TextView) findViewById(R.id.date);
558        mBatteryDisplay = (TextView) findViewById(R.id.battery);
559
560        mWeatherHighTemperature = (TextView) findViewById(R.id.weather_high_temperature);
561        mWeatherLowTemperature = (TextView) findViewById(R.id.weather_low_temperature);
562        mWeatherLocation = (TextView) findViewById(R.id.weather_location);
563        mWeatherIcon = (ImageView) findViewById(R.id.weather_icon);
564
565        mNextAlarm = (TextView) findViewById(R.id.nextAlarm);
566
567        final Button alarmButton = (Button) findViewById(R.id.alarm_button);
568        alarmButton.setOnClickListener(new View.OnClickListener() {
569            public void onClick(View v) {
570                startActivity(new Intent(DeskClock.this, AlarmClock.class));
571            }
572        });
573
574        final Button galleryButton = (Button) findViewById(R.id.gallery_button);
575        galleryButton.setOnClickListener(new View.OnClickListener() {
576            public void onClick(View v) {
577                try {
578                    startActivity(new Intent(
579                        Intent.ACTION_VIEW,
580                        android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
581                            .putExtra("slideshow", true));
582                } catch (android.content.ActivityNotFoundException e) {
583                    Log.e(LOG_TAG, "Couldn't launch image browser", e);
584                }
585            }
586        });
587
588        final Button musicButton = (Button) findViewById(R.id.music_button);
589        musicButton.setOnClickListener(new View.OnClickListener() {
590            public void onClick(View v) {
591                try {
592                    startActivity(new Intent(MUSIC_NOW_PLAYING));
593                } catch (android.content.ActivityNotFoundException e) {
594                    Log.e(LOG_TAG, "Couldn't launch music browser", e);
595                }
596            }
597        });
598
599        final Button homeButton = (Button) findViewById(R.id.home_button);
600        homeButton.setOnClickListener(new View.OnClickListener() {
601            public void onClick(View v) {
602                startActivity(
603                    new Intent(Intent.ACTION_MAIN)
604                        .addCategory(Intent.CATEGORY_HOME));
605            }
606        });
607
608        final Button nightmodeButton = (Button) findViewById(R.id.nightmode_button);
609        nightmodeButton.setOnClickListener(new View.OnClickListener() {
610            public void onClick(View v) {
611                mDimmed = ! mDimmed;
612                doDim(true);
613            }
614        });
615
616        nightmodeButton.setOnLongClickListener(new View.OnLongClickListener() {
617            public boolean onLongClick(View v) {
618                saveScreen();
619                return true;
620            }
621        });
622    }
623
624    @Override
625    public void onConfigurationChanged(Configuration newConfig) {
626        super.onConfigurationChanged(newConfig);
627        if (!mScreenSaverMode) {
628            initViews();
629            doDim(false);
630            refreshAll();
631        }
632    }
633
634    @Override
635    protected void onCreate(Bundle icicle) {
636        super.onCreate(icicle);
637
638        mRNG = new Random();
639
640        try {
641            mGenieResources = getPackageManager().getResourcesForApplication(GENIE_PACKAGE_ID);
642        } catch (PackageManager.NameNotFoundException e) {
643            // no weather info available
644            Log.w(LOG_TAG, "Can't find "+GENIE_PACKAGE_ID+". Weather forecast will not be available.");
645        }
646
647        initViews();
648    }
649
650}
651