@Override
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case LOADER_APPS:
       mDownloadHelper.updateLocalData(null);
       mAdapter.swapCursor(null);
       return;
     default:
       throw new RuntimeException("Unknown laoder id: " + loader.getId());
   }
 }
示例#2
0
  @Override
  public void onLoadFinished(Loader loader, Object object) {
    HashMap<Integer, Object> result = (HashMap<Integer, Object>) object;

    if (!isLoaderError(result)) {
      Object data = result.get(LoaderResult.DATA);

      if (loader.getId() == 0) {
        hideLoading();
        if (object != null) {
          this.mRepository = (Repository) data;
          fillTabs();
        }
        invalidateOptionsMenu();
      } else if (loader.getId() == 1) {
        stopProgressDialog(mProgressDialog);
        if (object != null) {
          this.mBranches = (List<RepositoryBranch>) data;
          showBranchesDialog();
        }
      } else if (loader.getId() == 2) {
        stopProgressDialog(mProgressDialog);
        if (object != null) {
          this.mTags = (List<RepositoryTag>) data;
          showTagsDialog();
        }
      } else if (loader.getId() == 3) {
        if (object != null) {
          isWatching = (Boolean) data;
          isFinishLoadingWatching = true;
        }
        invalidateOptionsMenu();
      } else {
        if (object != null) {
          isWatching = (Boolean) data;
          isFinishLoadingWatching = true;
          if (mRepositoryFragment != null) {
            // mRepositoryFragment.updateWatcherCount(isWatching);
          }
        }
        invalidateOptionsMenu();
      }
    } else {
      hideLoading();
      stopProgressDialog(mProgressDialog);
      invalidateOptionsMenu();
    }
  }
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case ID_LOADER:
       ((CursorAdapter) getListAdapter()).swapCursor(null);
   }
 }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
   Log.d(LOG_TAG, "OnLoadFinished");
   switch (loader.getId()) {
     case LOADER_PREVIEWS:
       mCursorRecyclerAdapter.swapCursor(cursor);
       int loaded = cursor.getCount();
       int preloadAmount = 0;
       Article.Category category = PreferencesUtility.readCategory(getActivity());
       Log.d(LOG_TAG, "Loaded: " + loaded);
       initEmptyView(loaded);
       if (category != Article.Category.FAVOURITES
           && loaded - currentState.lastLoadedAmount < ARTICLES_PER_PAGE
           && currentState.lastPageLoaded != currentState.currentPage) {
         if (isConnected()) {
           swipeRefreshLayout.setRefreshing(true);
           if (isWifi()
               || PreferencesUtility.readInternetType(getContext()) == NetworkManager.BOTH) {
             preloadAmount = PreferencesUtility.readPreloadAmount(getActivity());
           }
           startWebLoadService(category, currentState.currentPage, preloadAmount);
         } else {
           SnackbarUtility.createErrorSnackbar(
                   getActivity().findViewById(R.id.coordinatorLayout),
                   getString(R.string.error_no_interent))
               .show();
         }
       } else {
         finishLoading();
       }
       currentState.lastPageLoaded = currentState.currentPage;
       currentState.lastLoadedAmount = loaded;
       break;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished(android
  * .support.v4.content.Loader, java.lang.Object)
  */
 @SuppressLint("NewApi")
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
   switch (loader.getId()) {
     case LOADER_EPG:
       refresh(LOADER_CHANNELLIST);
       break;
     case LOADER_REFRESH_CHANNELLIST:
       /** Prüfung ob das EPG in der Senderliste angezeigt werden soll. */
       if ((showNowPlaying && !showNowPlayingWifi)
           || (showNowPlaying && showNowPlayingWifi && mNetworkInfo.isConnected())) {
         refresh(LOADER_EPG);
       } else {
         refresh(LOADER_CHANNELLIST);
       }
       break;
     default:
       mAdapter.swapCursor(cursor);
       if (selectedPosition != ListView.INVALID_POSITION) {
         getListView().setItemChecked(selectedPosition, true);
       }
       getListView()
           .setSelectionFromTop(
               selectedPosition,
               (int) getResources().getDimension(R.dimen.list_preferred_item_height_small) * 3);
       setListShown(true);
       break;
   }
   getSherlockActivity().invalidateOptionsMenu();
 }
示例#6
0
 /**
  * This is called when the last Cursor provided to onLoadFinished() above is about to be closed.
  * We need to make sure we are no longer using it.
  */
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case LOADER_ID_USER_IDS:
       mUserIdsAdapter.swapCursor(null);
       break;
   }
 }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    // This swaps the new cursor into the adapter.
    if (loader.getId() == ContactsQuery.QUERY_ID) {
      mAdapter.swapCursor(data);

      if (!TextUtils.isEmpty(mSearchTerm) && mSearchQueryChanged) {
        // Selects the first item in results, unless this fragment has
        // been restored from a saved state (like orientation change)
        // in which case it selects the previously selected search item.
        if (data != null && data.moveToPosition(mPreviouslySelectedSearchItem)) {
          // Creates the content Uri for the previously selected
          // contact by appending the
          // contact's ID to the Contacts table content Uri
          final Uri uri =
              Uri.withAppendedPath(
                  Contacts.CONTENT_URI, String.valueOf(data.getLong(ContactsQuery.ID)));
          mOnContactSelectedListener.onContactSelected(uri);
          getListView().setItemChecked(mPreviouslySelectedSearchItem, true);
        } else {
          // No results, clear selection.
          onSelectionCleared();
        }
        // Only restore from saved state one time. Next time fall back
        // to selecting first item. If the fragment state is saved again
        // then the currently selected item will once again be saved.
        mPreviouslySelectedSearchItem = 0;
        mSearchQueryChanged = false;
      }
    }
  }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
   // This swaps the new cursor into the adapter.
   if (loader.getId() == ContactsQuery.QUERY_ID) {
     mAdapter.swapCursor(data);
   }
 }
  @Override
  public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    CommitDetailsAdapter.Cards cardType = null;

    switch (cursorLoader.getId()) {
      case LOADER_COMMIT:
        cardType = CommitDetailsAdapter.Cards.COMMIT;
        break;
      case LOADER_PROPERTIES:
        cardType = CommitDetailsAdapter.Cards.PROPERTIES;
        break;
      case LOADER_MESSAGE:
        cardType = CommitDetailsAdapter.Cards.COMMIT_MSG;
        break;
      case LOADER_FILES:
        cardType = CommitDetailsAdapter.Cards.CHANGED_FILES;
        break;
      case LOADER_REVIEWERS:
        cardType = CommitDetailsAdapter.Cards.REVIEWERS;
        break;
      case LOADER_COMMENTS:
        cardType = CommitDetailsAdapter.Cards.COMMENTS;
        break;
    }
    if (cardType != null) mAdapter.setCursor(cardType, cursor);
  }
示例#10
0
 @Override
 public void onLoaderReset(Loader<Cursor> arg0) {
   switch (arg0.getId()) {
     case ExpenseEdit.TRANSACTION_CURSOR:
       mAdapter.swapCursor(null);
       break;
   }
 }
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   if (loader.getId() == ContactsQuery.QUERY_ID) {
     // When the loader is being reset, clear the cursor from the adapter. This allows the cursor
     // resources to be freed.
     mAdapter.swapCursor(null);
   }
 }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
   int id = loader.getId();
   switch (id) {
     case MyExpenses.SPLIT_PART_CURSOR:
       mAdapter.swapCursor(cursor);
   }
 }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    switch (loader.getId()) {
      case LOADER_ID:
        // 当为编辑闹钟状态时,铃声名为闹钟单例铃声名
        String ringName1;
        if (RingSelectFragment.sRingName != null) {
          ringName1 = RingSelectFragment.sRingName;
        } else {
          SharedPreferences share =
              getActivity()
                  .getSharedPreferences(WeacConstants.EXTRA_WEAC_SHARE, Activity.MODE_PRIVATE);
          // 当为新建闹钟状态时,铃声名为最近一次选择保存的铃声名
          ringName1 = share.getString(WeacConstants.RING_NAME, "");
        }
        // 保存铃声信息的List
        List<Map<String, String>> list = new ArrayList<>();
        // 过滤重复音频文件的Set
        HashSet<String> set = new HashSet<>();

        if (cursor != null) {
          for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
            // 音频文件名
            String ringName =
                cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
            // 取得音频文件的地址
            String ringUrl = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA));
            if (ringName != null) {
              // 当过滤集合里不存在此音频文件,并且文件扩展名不为[.amr],并且不是默认铃声
              if (!set.contains(ringName)
                  && !ringUrl.contains("/WeaAlarmClock/audio/record")
                  && !ringName.equals("record_start.mp3")
                  && !ringName.equals("record_stop.mp3")
                  && !ringName.equals("ring_weac_alarm_clock_default.mp3")) {
                // 添加音频文件到列表过滤同名文件
                set.add(ringName);
                // 去掉音频文件的扩展名
                ringName = MyUtil.removeEx(ringName);
                Map<String, String> map = new HashMap<>();
                map.put(WeacConstants.RING_NAME, ringName);
                map.put(WeacConstants.RING_URL, ringUrl);
                list.add(map);
                // 当列表中存在与保存的铃声名一致时,设置该列表的显示位置
                if (ringName.equals(ringName1)) {
                  mPosition = list.size() - 1;
                  RingSelectItem.getInstance().setRingPager(1);
                }
              }
            }
          }
        }

        mLocalMusicAdapter = new RingSelectAdapter(getActivity(), list, ringName1);
        setListAdapter(mLocalMusicAdapter);
        setSelection(mPosition);
        break;
    }
  }
示例#14
0
 /**
  * Loader has finished. Called when a previously created loader has finished its load. Notify
  * listener
  *
  * @param loader
  * @param localPhotosResult
  */
 @Override
 public void onLoadFinished(
     Loader<LocalPhotosResult> loader, LocalPhotosResult localPhotosResult) {
   Log.d(TAG, "onLoadFinished:");
   PhotosLoaderListener loaderListener = loaderListenerWeakRef.get();
   if (loaderListener != null) {
     loaderListener.onLoadComplete(loader.getId(), localPhotosResult);
   }
 }
示例#15
0
 @Override
 public void TweetLoaderCallbacks(Status result, Loader<Status> paramLoader) {
   getLoaderManager().destroyLoader(paramLoader.getId()); // ツイートしたら破棄
   // ソフトキー外す
   InputMethodManager imm =
       (InputMethodManager) getSherlockActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(twTx.getWindowToken(), 0);
   ((TextView) getSherlockActivity().findViewById(R.id.editText)).setText("");
 }
  @Override
  public void onLoadFinished(Loader<BitmapResult> loader, BitmapResult result) {
    // If we don't have a view, the fragment has been paused. We'll get the cursor again later.
    // If we're not added, the fragment has detached during the loading process. We no longer
    // need the result.
    if (getView() == null || !isAdded()) {
      return;
    }

    final Drawable data = result.getDrawable(getResources());

    final int id = loader.getId();
    switch (id) {
      case PhotoViewCallbacks.BITMAP_LOADER_THUMBNAIL:
        if (mDisplayThumbsFullScreen) {
          displayPhoto(result);
        } else {
          if (isPhotoBound()) {
            // There is need to do anything with the thumbnail
            // image, as the full size image is being shown.
            return;
          }

          if (data == null) {
            // no preview, show default
            mPhotoPreviewImage.setImageResource(R.drawable.default_image);
            mThumbnailShown = false;
          } else {
            // show preview
            mPhotoPreviewImage.setImageDrawable(data);
            mThumbnailShown = true;
          }
          mPhotoPreviewImage.setVisibility(View.VISIBLE);
          if (getResources().getBoolean(R.bool.force_thumbnail_no_scaling)) {
            mPhotoPreviewImage.setScaleType(ImageView.ScaleType.CENTER);
          }
          enableImageTransforms(false);
        }
        break;

      case PhotoViewCallbacks.BITMAP_LOADER_PHOTO:
        displayPhoto(result);
        break;
      default:
        break;
    }

    if (mProgressBarNeeded == false) {
      // Hide the progress bar as it isn't needed anymore.
      mPhotoProgressBar.setVisibility(View.GONE);
    }

    if (data != null) {
      mCallback.onNewPhotoLoaded(mPosition);
    }
    setViewVisibility();
  }
 @Override
 public void onLoadFinished(Loader<Boolean> booleanLoader, Boolean hasUnits) {
   if (booleanLoader != null && booleanLoader.getId() == CHECK_LOADER_ID) {
     mOrgUnitButton.setEnabled(hasUnits);
     if (hasUnits) {
       onRestoreInstanceState();
     }
   }
 }
示例#18
0
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case SORTABLE_CURSOR:
       mTemplatesCursor = null;
       mAdapter.swapCursor(null);
       break;
   }
 }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {

    if (loader.getId() == FRIENDS_LOADER_ID) {

      mAdapter.swapCursor(cursor);
      setListShown(false);
      setCreatePhotoVisible(cursor != null && cursor.getCount() > 0);
    }
  }
  @Override
  public void onLoaderReset(Loader<Cursor> loader) {
    super.onLoaderReset(loader);
    switch (loader.getId()) {
      case LOADER_SALESCATEGORY:
        salesCategoryAdapter.swapCursor(null);

        break;
    }
  }
 @Override
 public void onLoadFinished(
     Loader<SelectProgramFragmentForm> loader, SelectProgramFragmentForm data) {
   if (LOADER_ID == loader.getId()) {
     mProgressBar.setVisibility(View.GONE);
     mForm = data;
     ((TrackedEntityInstanceAdapter) mAdapter).setData(data.getEventRowList());
     mAdapter.swapData(data.getEventRowList());
   }
 }
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case MOVIE_TRAILER_LOADER:
       mTrailersListAdapter.swapCursor(null);
       break;
     case MOVIE_REVIEW_LOADER:
       mReviewsListAdapter.swapCursor(null);
       break;
   }
 }
示例#23
0
 public void onLoaderReset(Loader<Cursor> paramLoader)
 {
   switch (paramLoader.getId())
   {
   default:
     return;
   case 1:
   case 2:
   }
   this.mFeedAdapter.swapCursor(null);
 }
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   switch (loader.getId()) {
     case TRACKS_LOADER_ID:
       mCursorAdapter.swapCursor(null);
       mCursor = null;
       break;
     default:
       break;
   }
 }
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
    super.onLoadFinished(loader, c);

    switch (loader.getId()) {
      case LOADER_SALESCATEGORY:
        salesCategoryAdapter.swapCursor(c);

        break;
    }
  }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
   // swap cursor in the adapter
   switch (loader.getId()) {
     case EVENT_LIST_LOADER_ID:
       setChart(cursor);
       break;
     default:
       Log.e(TAG, "Unknown adapter id");
   }
 }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
   switch (loader.getId()) {
     case ID_LOADER:
       ((CursorAdapter) getListAdapter()).swapCursor(data);
       if (isResumed()) {
         setListShown(true);
       } else {
         setListShownNoAnimation(true);
       }
       break;
   }
 }
示例#28
0
  @Override
  public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    switch (cursorLoader.getId()) {
      case LOADER_PARENT_CATEGORY:
        bindParent(cursor);
        break;

      case LOADER_TRANSACTIONS:
        bindTransactions(cursor);
        break;
    }
    super.onLoadFinished(cursorLoader, cursor);
  }
示例#29
0
 @Override
 public void onLoadFinished(Loader<Cursor> arg0, Cursor c) {
   switch (arg0.getId()) {
     case ExpenseEdit.TRANSACTION_CURSOR:
       mAdapter.swapCursor(c);
       if (c.getCount() > 0) ((ExpenseEdit) getActivity()).disableAccountSpinner();
       break;
     case ExpenseEdit.SUM_CURSOR:
       c.moveToFirst();
       transactionSum = c.getLong(0);
       updateBalance();
   }
 }
 @Override
 public void onLoaderReset(Loader<Cursor> cursorLoader) {
   final int id = cursorLoader.getId();
   switch (id) {
     case PriorityLoaderId:
       adPriority.swapCursor(null);
       return;
     case StatusLoaderId:
       adStatus.swapCursor(null);
       return;
     default:
   }
 }