/** Set up spinner navigation with swiped pages */ private void setUpNavigation() { // Navigation spinner in toolbar for trainings selection LayoutInflater.from(mToolbar.getContext()).inflate(R.layout.navigation_spinner, mToolbar, true); mNavigationSpinner = (Spinner) mToolbar.findViewById(R.id.navigation_spinner); mNavigationSpinner.setOnItemSelectedListener(this); mNavigationSpinner.setSelection(mPosition); String[] from = new String[] {Trainings.EXERCISE}; int[] to = new int[] {R.id.title}; mNavigationAdapter = new NavigationAdapter( mToolbar.getContext(), R.layout.navigation_spinner_item, null, from, to, 0); mNavigationAdapter.setDropDownViewResource(R.layout.navigation_spinner_dropdown_item); mNavigationSpinner.setAdapter(mNavigationAdapter); // ViewPager for swipe navigation and animation on training select mViewPager.setOnPageChangeListener(this); mPagerAdapter = new TrainingPagerAdapter(getChildFragmentManager(), null); mViewPager.setAdapter(mPagerAdapter); Loader<Cursor> loader = getLoaderManager().getLoader(0); if (loader != null && !loader.isReset()) { getLoaderManager().restartLoader(0, null, this); } else { getLoaderManager().initLoader(0, null, this); } }
void a() { if (i && j) { h = true; } else if (!h) { h = true; if (J.b) { Log.v("LoaderManager", (new StringBuilder()).append(" Starting: ").append(this).toString()); } if (d == null && c != null) { d = c.onCreateLoader(a, b); } if (d != null) { if (d.getClass().isMemberClass() && !Modifier.isStatic(d.getClass().getModifiers())) { throw new IllegalArgumentException((new StringBuilder()).append("Object returned from onCreateLoader must not be a non-static inner member class: ").append(d).toString()); } if (!m) { d.registerListener(a, this); m = true; } d.startLoading(); return; } } }
void f() { if (J.b) { Log.v("LoaderManager", (new StringBuilder()).append(" Destroying: ").append(this).toString()); } l = true; boolean flag = f; f = false; if (c == null || d == null || !e || !flag) { break MISSING_BLOCK_LABEL_182; } if (J.b) { Log.v("LoaderManager", (new StringBuilder()).append(" Reseting: ").append(this).toString()); } String s; Exception exception; if (o.f != null) { String s1 = o.f.e.z; o.f.e.z = "onLoaderReset"; s = s1; } else { s = null; } c.onLoaderReset(d); if (o.f != null) { o.f.e.z = s; } c = null; g = null; e = false; if (d != null) { if (m) { m = false; d.unregisterListener(this); } d.reset(); } if (n != null) { n.f(); } return; exception; if (o.f != null) { o.f.e.z = s; } throw exception; }
private void resetCursorLoaderUri() { Loader<Cursor> loader = getLoaderManager().getLoader(LOADER_ID_LIST); if (loader == null) { return; } CursorLoader cl = (CursorLoader) loader; cl.setUri(POIs.createUriSorted(mLocation)); loader.forceLoad(); }
@Override public void onChange(boolean selfChange) { if (getActivity() == null) { return; } Loader<Cursor> loader = getLoaderManager().getLoader(0); if (loader != null) { loader.forceLoad(); } }
@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()); } }
@Override public void resetDataset(int viewIndex) { Log.d(LOGTAG, "Resetting dataset: " + viewIndex); final LoaderManager lm = getLoaderManager(); // Release any resources associated with the dataset if // it's currently loaded in memory. final Loader<?> datasetLoader = lm.getLoader(viewIndex); if (datasetLoader != null) { datasetLoader.reset(); } }
void e() { if (J.b) { Log.v("LoaderManager", (new StringBuilder()).append(" Stopping: ").append(this).toString()); } h = false; if (!i && d != null && m) { m = false; d.unregisterListener(this); d.stopLoading(); } }
/** reloadStores and clean Contextual Action Bar if present */ public void reloadStores() { Log.v("SOURCES", "reloading sources"); Loader l = getSherlockActivity().getSupportLoaderManager().getLoader(LOADER_INDEX); if (l != null) { adapter.clear(); l.forceLoad(); } if (actionMode != null) { actionMode.finish(); selected = new ArrayList<LayerStore>(); getListView().clearChoices(); getListView().clearFocus(); } }
@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 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); }
@Override public void onLoaderReset(Loader<Cursor> loader) { switch (loader.getId()) { case ID_LOADER: ((CursorAdapter) getListAdapter()).swapCursor(null); } }
public void dump( String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) { super.dump(str, fileDescriptor, printWriter, strArr); if (this.mTask != null) { printWriter.print(str); printWriter.print("mTask="); printWriter.print(this.mTask); printWriter.print(" waiting="); printWriter.println(this.mTask.waiting); } if (this.mCancellingTask != null) { printWriter.print(str); printWriter.print("mCancellingTask="); printWriter.print(this.mCancellingTask); printWriter.print(" waiting="); printWriter.println(this.mCancellingTask.waiting); } if (this.mUpdateThrottle != 0) { printWriter.print(str); printWriter.print("mUpdateThrottle="); TimeUtils.formatDuration(this.mUpdateThrottle, printWriter); printWriter.print(" mLastLoadCompleteTime="); TimeUtils.formatDuration(this.mLastLoadCompleteTime, SystemClock.uptimeMillis(), printWriter); printWriter.println(); } }
void callOnLoadFinished(Loader<Object> paramLoader, Object paramObject) { if (this.mCallbacks == null) return; String str1 = null; if (LoaderManagerImpl.this.mActivity != null) { str1 = LoaderManagerImpl.this.mActivity.mFragments.mNoTransactionsBecause; LoaderManagerImpl.this.mActivity.mFragments.mNoTransactionsBecause = "onLoadFinished"; } try { if (LoaderManagerImpl.DEBUG) { StringBuilder localStringBuilder = new StringBuilder().append(" onLoadFinished in ").append(paramLoader).append(": "); String str2 = paramLoader.dataToString(paramObject); String str3 = str2; int i = Log.v("LoaderManager", str3); } this.mCallbacks.onLoadFinished(paramLoader, paramObject); if (LoaderManagerImpl.this.mActivity != null) LoaderManagerImpl.this.mActivity.mFragments.mNoTransactionsBecause = str1; this.mDeliveredData = true; return; } finally { if (LoaderManagerImpl.this.mActivity != null) LoaderManagerImpl.this.mActivity.mFragments.mNoTransactionsBecause = str1; } }
public void a( String paramString, FileDescriptor paramFileDescriptor, PrintWriter paramPrintWriter, String[] paramArrayOfString) { super.a(paramString, paramFileDescriptor, paramPrintWriter, paramArrayOfString); if (this.a != null) { paramPrintWriter.print(paramString); paramPrintWriter.print("mTask="); paramPrintWriter.print(this.a); paramPrintWriter.print(" waiting="); paramPrintWriter.println(this.a.b); } if (this.b != null) { paramPrintWriter.print(paramString); paramPrintWriter.print("mCancellingTask="); paramPrintWriter.print(this.b); paramPrintWriter.print(" waiting="); paramPrintWriter.println(this.b.b); } if (this.c != 0L) { paramPrintWriter.print(paramString); paramPrintWriter.print("mUpdateThrottle="); TimeUtils.a(this.c, paramPrintWriter); paramPrintWriter.print(" mLastLoadCompleteTime="); TimeUtils.a(this.d, SystemClock.uptimeMillis(), paramPrintWriter); paramPrintWriter.println(); } }
@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); } }
/** * 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; } }
void callOnLoadFinished(Loader<Object> paramLoader, Object paramObject) { String str; if (this.mCallbacks != null) { str = null; if (LoaderManagerImpl.this.mHost != null) { str = LoaderManagerImpl.this.mHost.mFragmentManager.mNoTransactionsBecause; LoaderManagerImpl.this.mHost.mFragmentManager.mNoTransactionsBecause = "onLoadFinished"; } } try { if (LoaderManagerImpl.DEBUG) { Log.v( "LoaderManager", " onLoadFinished in " + paramLoader + ": " + paramLoader.dataToString(paramObject)); } this.mCallbacks.onLoadFinished(paramLoader, paramObject); if (LoaderManagerImpl.this.mHost != null) { LoaderManagerImpl.this.mHost.mFragmentManager.mNoTransactionsBecause = str; } this.mDeliveredData = true; return; } finally { if (LoaderManagerImpl.this.mHost != null) { LoaderManagerImpl.this.mHost.mFragmentManager.mNoTransactionsBecause = str; } } }
/* * (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(); }
@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; } }
@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 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); } }
public void onLoadComplete(Loader<Object> paramLoader, Object paramObject) { if (LoaderManagerImpl.DEBUG) { Log.v("LoaderManager", "onLoadComplete: " + this); } if (this.mDestroyed) { if (LoaderManagerImpl.DEBUG) { Log.v("LoaderManager", " Ignoring load complete -- destroyed"); } } do { do { return; if (LoaderManagerImpl.this.mLoaders.get(this.mId) == this) { break; } } while (!LoaderManagerImpl.DEBUG); Log.v("LoaderManager", " Ignoring load complete -- not active"); return; LoaderInfo localLoaderInfo = this.mPendingLoader; if (localLoaderInfo != null) { if (LoaderManagerImpl.DEBUG) { Log.v("LoaderManager", " Switching to pending loader: " + localLoaderInfo); } this.mPendingLoader = null; LoaderManagerImpl.this.mLoaders.put(this.mId, null); destroy(); LoaderManagerImpl.this.installLoader(localLoaderInfo); return; } if ((this.mData != paramObject) || (!this.mHaveData)) { this.mData = paramObject; this.mHaveData = true; if (this.mStarted) { callOnLoadFinished(paramLoader, paramObject); } } paramLoader = (LoaderInfo) LoaderManagerImpl.this.mInactiveLoaders.get(this.mId); if ((paramLoader != null) && (paramLoader != this)) { paramLoader.mDeliveredData = false; paramLoader.destroy(); LoaderManagerImpl.this.mInactiveLoaders.remove(this.mId); } } while ((LoaderManagerImpl.this.mHost == null) || (LoaderManagerImpl.this.hasRunningLoaders())); LoaderManagerImpl.this.mHost.mFragmentManager.startPendingDeferredFragments(); }
@Override public void onLoaderReset(Loader<Cursor> arg0) { switch (arg0.getId()) { case ExpenseEdit.TRANSACTION_CURSOR: mAdapter.swapCursor(null); break; } }
@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; } }
@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 onLoaderReset(Loader<Cursor> loader) { switch (loader.getId()) { case SORTABLE_CURSOR: mTemplatesCursor = null; mAdapter.swapCursor(null); break; } }
@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 onResume() { super.onResume(); if (movie == null) { Log.i(LOG_TAG, "no movie selected yet in twoPaneLayout"); return; } if (movieDetails != null) { Log.i( LOG_TAG, "movieDetails for movie " + movie.title + " have already been initialized - won't do it again"); return; } Loader<MovieDetails> loader = getLoaderManager().initLoader(0, null, this); Log.i(LOG_TAG, "created loader for movie " + movie.title + ": " + loader.getId()); }