Esempio n. 1
0
 /**
  * Initialize unread number by querying system settings provider.
  *
  * @param context
  */
 private void initUnreadNumberFromSystem() {
   final ContentResolver cr = mContext.getContentResolver();
   final int shortcutsNum = sUnreadSupportShortcutsNum;
   UnreadSupportShortcut shortcut = null;
   for (int i = 0; i < shortcutsNum; i++) {
     shortcut = UNREAD_SUPPORT_SHORTCUTS.get(i);
     try {
       shortcut.mUnreadNum = android.provider.Settings.System.getInt(cr, shortcut.mKey);
       if (LauncherLog.DEBUG_UNREAD) {
         LauncherLog.d(
             TAG,
             "initUnreadNumberFromSystem: key = "
                 + shortcut.mKey
                 + ", unreadNum = "
                 + shortcut.mUnreadNum);
       }
     } catch (android.provider.Settings.SettingNotFoundException e) {
       LauncherLog.e(
           TAG,
           "initUnreadNumberFromSystem SettingNotFoundException key = "
               + shortcut.mKey
               + ", e = "
               + e.getMessage());
     }
   }
   if (LauncherLog.DEBUG_UNREAD) {
     LauncherLog.d(TAG, "initUnreadNumberFromSystem end:" + getUnreadSupportShortcutInfo());
   }
 }
 @Override
 protected Bitmap doInBackground(Integer... params) {
   if (isCancelled() || !isAdded()) {
     // If the fragment is not added(attached) to an activity, return null.
     LauncherLog.d(
         TAG,
         "WallpaperLoader doInBackground: canceled = "
             + isCancelled()
             + ",isAdded() = "
             + isAdded()
             + ",activity = "
             + getActivity());
     return null;
   }
   try {
     return BitmapFactory.decodeResource(getResources(), mImages.get(params[0]), mOptions);
   } catch (OutOfMemoryError e) {
     LauncherLog.e(TAG, "WallpaperLoader decode resource out of memory " + e.getMessage());
     return null;
   }
 }