@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final View view = getView(); if (view == null) throw new AssertionError(); final Context viewContext = view.getContext(); mMultiSelectManager = getMultiSelectManager(); final MessageEntriesAdapter adapter = getAdapter(); final RecyclerView recyclerView = getRecyclerView(); final LinearLayoutManager layoutManager = getLayoutManager(); mNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter, this); adapter.setListener(this); final DividerItemDecoration itemDecoration = new DividerItemDecoration(viewContext, layoutManager.getOrientation()); final Resources res = viewContext.getResources(); final int decorPaddingLeft = res.getDimensionPixelSize(R.dimen.element_spacing_normal) * 3 + res.getDimensionPixelSize(R.dimen.icon_size_status_profile_image); itemDecoration.setPadding(decorPaddingLeft, 0, 0, 0); itemDecoration.setDecorationEndOffset(1); recyclerView.addItemDecoration(itemDecoration); getLoaderManager().initLoader(0, null, this); showProgress(); }
@Override public void onStart() { super.onStart(); final ContentResolver resolver = getContentResolver(); resolver.registerContentObserver(Accounts.CONTENT_URI, true, mReloadContentObserver); final Bus bus = TwittnukerApplication.getInstance(getActivity()).getMessageBus(); bus.register(this); final MessageEntriesAdapter adapter = getAdapter(); adapter.updateReadState(); updateRefreshState(); }
@Override protected Object doInBackground(final Object... params) { for (final int pos : read_positions) { final DirectMessageEntry entry = adapter.getEntry(pos); final long id = entry.conversation_id, account_id = entry.account_id; fragment.addUnreadCountsToRemove(account_id, id); } return null; }
@Override public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) { if (getActivity() == null) return; mFirstVisibleItem = -1; final MessageEntriesAdapter adapter = getAdapter(); adapter.setCursor(cursor); adapter.setLoadMoreIndicatorVisible(false); adapter.setLoadMoreSupported(cursor != null && cursor.getCount() > 0); adapter.setLoadMoreSupported(hasMoreData(cursor)); final long[] accountIds = getAccountIds(); adapter.setShowAccountsColor(accountIds.length > 1); setRefreshEnabled(true); if (accountIds.length > 0) { showContent(); } else { showError(R.drawable.ic_info_accounts, getString(R.string.no_account_selected)); } }
@Override public void onLoaderReset(final Loader<Cursor> loader) { final MessageEntriesAdapter adapter = getAdapter(); adapter.setCursor(null); }