use of android.support.v7.widget.RecyclerView.Adapter in project Tusky by Vavassor.
the class ReportActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_report);
Intent intent = getIntent();
accountId = intent.getStringExtra("account_id");
String accountUsername = intent.getStringExtra("account_username");
String statusId = intent.getStringExtra("status_id");
String statusContent = intent.getStringExtra("status_content");
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
String title = String.format(getString(R.string.report_username_format), accountUsername);
bar.setTitle(title);
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
anyView = toolbar;
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.report_recycler_view);
recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
adapter = new ReportAdapter();
recyclerView.setAdapter(adapter);
DividerItemDecoration divider = new DividerItemDecoration(this, layoutManager.getOrientation());
Drawable drawable = ThemeUtils.getDrawable(this, R.attr.report_status_divider_drawable, R.drawable.report_status_divider_dark);
divider.setDrawable(drawable);
recyclerView.addItemDecoration(divider);
ReportAdapter.ReportStatus reportStatus = new ReportAdapter.ReportStatus(statusId, HtmlUtils.fromHtml(statusContent), true);
adapter.addItem(reportStatus);
comment = (EditText) findViewById(R.id.report_comment);
reportAlreadyInFlight = false;
fetchRecentStatuses(accountId);
}
use of android.support.v7.widget.RecyclerView.Adapter in project Robot-Scouter by SUPERCILEX.
the class StopwatchViewHolder method bind.
@Override
protected void bind() {
super.bind();
mToggleStopwatch.setOnClickListener(this);
setText(R.string.start_stopwatch);
Tasks.whenAll(getOnViewReadyTask(getName()), getOnViewReadyTask(mToggleStopwatch)).addOnSuccessListener(this);
LinearLayoutManager manager = new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false);
manager.setInitialPrefetchItemCount(5);
mCycles.setLayoutManager(manager);
mCycles.setAdapter(new Adapter());
Timer timer = TIMERS.get(getMetric());
if (timer != null) {
timer.setHolder(this);
mTimer = timer;
mTimer.updateButtonTime();
}
}
use of android.support.v7.widget.RecyclerView.Adapter in project Rocket.Chat.Android by RocketChat.
the class SidebarMainFragment method onSetupView.
@SuppressLint("RxLeakedSubscription")
@Override
protected void onSetupView() {
setupUserActionToggle();
setupUserStatusButtons();
setupLogoutButton();
setupVersionInfo();
adapter = new RoomListAdapter();
adapter.setOnItemClickListener(new RoomListAdapter.OnItemClickListener() {
@Override
public void onItemClick(Room room) {
searchView.clearFocus();
presenter.onRoomSelected(room);
}
@Override
public void onItemClick(SpotlightRoom spotlightRoom) {
searchView.setQuery(null, false);
searchView.clearFocus();
methodCallHelper.joinRoom(spotlightRoom.getId()).onSuccessTask(task -> {
presenter.onSpotlightRoomSelected(spotlightRoom);
return null;
});
}
});
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.room_list_container);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
searchView = (SearchView) rootView.findViewById(R.id.search);
RxSearchView.queryTextChanges(searchView).compose(bindToLifecycle()).debounce(300, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).switchMap(it -> {
if (it.length() == 0) {
adapter.setMode(RoomListAdapter.MODE_ROOM);
return Observable.just(Collections.<SpotlightRoom>emptyList());
}
adapter.setMode(RoomListAdapter.MODE_SPOTLIGHT_ROOM);
final String queryString = it.toString();
methodCallHelper.searchSpotlightRooms(queryString);
return realmSpotlightRoomRepository.getSuggestionsFor(queryString, SortDirection.DESC, 10).toObservable();
}).subscribe(this::showSearchSuggestions, Logger::report);
}
use of android.support.v7.widget.RecyclerView.Adapter in project Rocket.Chat.Android by RocketChat.
the class RoomFragment method onDestroyView.
@Override
public void onDestroyView() {
RecyclerView listView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
if (listView != null) {
RecyclerView.Adapter adapter = listView.getAdapter();
if (adapter != null) {
adapter.unregisterAdapterDataObserver(autoScrollManager);
}
}
compositeDisposable.clear();
if (autocompleteManager != null) {
autocompleteManager.dispose();
autocompleteManager = null;
}
super.onDestroyView();
}
use of android.support.v7.widget.RecyclerView.Adapter in project Rocket.Chat.Android by RocketChat.
the class RoomFragment method updateHistoryState.
@Override
public void updateHistoryState(boolean hasNext, boolean isLoaded) {
RecyclerView listView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
if (listView == null || !(listView.getAdapter() instanceof MessageListAdapter)) {
return;
}
MessageListAdapter adapter = (MessageListAdapter) listView.getAdapter();
if (isLoaded) {
scrollListener.setLoadingDone();
}
adapter.updateFooter(hasNext, isLoaded);
}
Aggregations