Java Code Examples for android.support.v7.widget.LinearLayoutManager#setStackFromEnd()
The following examples show how to use
android.support.v7.widget.LinearLayoutManager#setStackFromEnd() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileViewerFragment.java From SoundRecorder with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_file_viewer, container, false); RecyclerView mRecyclerView = (RecyclerView) v.findViewById(R.id.recyclerView); mRecyclerView.setHasFixedSize(true); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); //newest to oldest order (database stores from oldest to newest) llm.setReverseLayout(true); llm.setStackFromEnd(true); mRecyclerView.setLayoutManager(llm); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mFileViewerAdapter = new FileViewerAdapter(getActivity(), llm); mRecyclerView.setAdapter(mFileViewerAdapter); return v; }
Example 2
Source File: MessageList.java From aurora-imui with MIT License | 6 votes |
/** * Set adapter for MessageList. * * @param adapter Adapter, extends MsgListAdapter. * @param <MESSAGE> Message model extends IMessage. */ public <MESSAGE extends IMessage> void setAdapter(MsgListAdapter<MESSAGE> adapter) { mAdapter = adapter; SimpleItemAnimator itemAnimator = new DefaultItemAnimator(); itemAnimator.setSupportsChangeAnimations(false); setItemAnimator(itemAnimator); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, true); layoutManager.setStackFromEnd(true); setLayoutManager(layoutManager); adapter.setLayoutManager(layoutManager); adapter.setStyle(mContext, mMsgListStyle); mScrollMoreListener = new ScrollMoreListener(layoutManager, adapter); addOnScrollListener(mScrollMoreListener); super.setAdapter(adapter); }
Example 3
Source File: PlayListFragment.java From Android-AudioRecorder-App with Apache License 2.0 | 6 votes |
private void initViews(View v) { emptyListLabel = v.findViewById(R.id.empty_list_label); mRecordingsListView = v.findViewById(R.id.recyclerView); mRecordingsListView.setHasFixedSize(true); LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); //newest to oldest order (database stores from oldest to newest) llm.setReverseLayout(true); llm.setStackFromEnd(true); mRecordingsListView.setLayoutManager(llm); //mRecordingsListView.setItemAnimator(new DefaultItemAnimator()); mRecordingsListView.setAdapter(mPlayListAdapter); playListPresenter.onViewInitialised(); }
Example 4
Source File: ChatActivity.java From Saude-no-Mapa with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); ButterKnife.bind(this); toolbar.setNavigationIcon(R.drawable.ic_arrow_back); toolbar.setNavigationOnClickListener(v -> { finishActivity(); }); mLinearLayoutManager = new LinearLayoutManager(this); mLinearLayoutManager.setStackFromEnd(true); messageRecyclerView.setLayoutManager(mLinearLayoutManager); mPresenter = new ChatPresenterImpl(this, this); }
Example 5
Source File: FormBuilder.java From FormMaster with Apache License 2.0 | 6 votes |
/** * private method for initializing form build helper * @param context * @param recyclerView * @param listener */ private void initializeFormBuildHelper(Context context, RecyclerView recyclerView, OnFormElementValueChangedListener listener) { // initialize form adapter this.mFormAdapter = new FormAdapter(context, listener); // set up the recyclerview with adapter LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); linearLayoutManager.setStackFromEnd(false); recyclerView.setLayoutManager(linearLayoutManager); recyclerView.setAdapter(mFormAdapter); recyclerView.setItemAnimator(new DefaultItemAnimator()); }
Example 6
Source File: ChatActivity.java From Simple-Blog-App with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); FloatingActionButton fab = findViewById(R.id.fab); chatRecView = findViewById(R.id.list_of_messages); dbChatRef = FirebaseDatabase.getInstance().getReference("/chat"); LinearLayoutManager layoutManager = new LinearLayoutManager(this); layoutManager.setStackFromEnd(false); chatRecView.setHasFixedSize(true); chatRecView.setLayoutManager(layoutManager); if (FirebaseAuth.getInstance().getCurrentUser() == null) { startActivity(new Intent(ChatActivity.this, LoginActivity.class)); } fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fabClick(); } }); }
Example 7
Source File: ActivityTelegram.java From emoji-keyboard with Apache License 2.0 | 5 votes |
private void initMessageList() { this.mMessages = (RecyclerView) this.findViewById(R.id.messages); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setStackFromEnd(Boolean.TRUE); this.mMessages.setLayoutManager(linearLayoutManager); this.mAdapter = new MessageAdapter(new ArrayList<Message>()); this.mMessages.setAdapter(mAdapter); }
Example 8
Source File: DownloadsFragment.java From OneTapVideoDownload with GNU General Public License v3.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View rootView = inflater.inflate(R.layout.fragment_downloads, container, false); mRecyclerView = (RecyclerView) rootView.findViewById(R.id.downloadRecyclerView); ((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setReverseLayout(true); layoutManager.setStackFromEnd(true); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setHasFixedSize(true); mDownloadAdapter = new DownloadAdapter(getActivity()); mRecyclerView.setAdapter(mDownloadAdapter); mEmptyView = rootView.findViewById(R.id.empty_view); FloatingActionButton usageInstructionButton = (FloatingActionButton)rootView.findViewById(R.id.usage_instruction_button); usageInstructionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent usageInstructionIntent = new Intent(getActivity(), UsageInstruction.class); startActivity(usageInstructionIntent); } }); return rootView; }
Example 9
Source File: ChatFragment.java From Game-of-Thrones with Apache License 2.0 | 5 votes |
private void initRecyclerView(RVRendererAdapter chatAdapter) { messageRecyclerView.setAdapter(chatAdapter); LinearLayoutManager recyclerViewManager = new LinearLayoutManager(getActivity()); recyclerViewManager.setStackFromEnd(true); messageRecyclerView.setLayoutManager(recyclerViewManager); messageRecyclerView.setHasFixedSize(true); }
Example 10
Source File: ActivityWhatsApp.java From emoji-keyboard with Apache License 2.0 | 5 votes |
private void initMessageList() { this.mMessages = (RecyclerView) this.findViewById(R.id.messages); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setStackFromEnd(Boolean.TRUE); this.mMessages.setLayoutManager(linearLayoutManager); this.mAdapter = new MessageAdapter(new ArrayList<Message>()); this.mMessages.setAdapter(mAdapter); }
Example 11
Source File: Drawers.java From ForPDA with GNU General Public License v3.0 | 5 votes |
public Drawers(MainActivity activity, DrawerLayout drawerLayout) { this.activity = activity; this.drawerLayout = drawerLayout; menuDrawer = (NavigationView) activity.findViewById(R.id.menu_drawer); tabDrawer = (NavigationView) activity.findViewById(R.id.tab_drawer); menuListView = (RecyclerView) activity.findViewById(R.id.menu_list); tabListView = (RecyclerView) activity.findViewById(R.id.tab_list); forbiddenError = (TextView) activity.findViewById(R.id.forbidden_error); tabCloseAllButton = (Button) activity.findViewById(R.id.tab_close_all); menuListLayoutManager = new LinearLayoutManager(activity); tabListLayoutManager = new LinearLayoutManager(activity); tabListLayoutManager.setStackFromEnd(Preferences.Main.isTabsBottom(activity)); menuListView.setLayoutManager(menuListLayoutManager); tabListView.setLayoutManager(tabListLayoutManager); menuAdapter = new MenuAdapter(); tabAdapter = new TabAdapter(); menuListView.setAdapter(menuAdapter); tabListView.setAdapter(tabAdapter); menuAdapter.setItems(menuItems); tabCloseAllButton.setOnClickListener(v -> closeAllTabs()); App.get().addPreferenceChangeObserver(preferenceObserver); App.get().addStatusBarSizeObserver(statusBarSizeObserver); App.get().subscribeForbidden(forbiddenObserver); }
Example 12
Source File: MainActivity.java From Simple-Blog-App with MIT License | 5 votes |
private void blogList() { mBlogList = findViewById(R.id.blog_list); LinearLayoutManager layoutManager = new LinearLayoutManager(this); layoutManager.setReverseLayout(true); layoutManager.setStackFromEnd(true); mBlogList.setHasFixedSize(true); mBlogList.setLayoutManager(layoutManager); floatingActionButton = findViewById(R.id.fab); }
Example 13
Source File: BaseEvaluatorActivity.java From ncalc with GNU General Public License v3.0 | 5 votes |
private void initView() { mBtnEvaluate = findViewById(R.id.btn_solve); mInputFormula = findViewById(R.id.edit_input); mInputFormula.setOnSuggestionClickListener(this); mProgress = findViewById(R.id.progress_bar); mSpinner = findViewById(R.id.spinner); mBtnClear = findViewById(R.id.btn_clear); mInputFormula2 = findViewById(R.id.edit_input_2); mHint1 = findViewById(R.id.hint_1); mHint2 = findViewById(R.id.hint_2); mBtnClear.setOnClickListener(this); mBtnEvaluate.setOnClickListener(this); mProgress.hide(); findViewById(R.id.fab_help).setOnClickListener(this); mEditLowerBound = findViewById(R.id.edit_lower); mEditUpperBound = findViewById(R.id.edit_upper); mLayoutLimit = findViewById(R.id.layout_limit); mLayoutLimit.setVisibility(View.GONE); mInputFormula.setOnKeyListener(mFormulaOnKeyListener); mResultView = findViewById(R.id.rc_result); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setStackFromEnd(false); mResultView.setHasFixedSize(true); mResultView.setLayoutManager(linearLayoutManager); mResultAdapter = new ResultAdapter(this); mResultView.setAdapter(mResultAdapter); }
Example 14
Source File: MainActivity.java From Ucount with GNU General Public License v3.0 | 5 votes |
public void setIoItemRecyclerView(Context context) { // 用于存储recyclerView的日期 GlobalVariables.setmDate(""); LinearLayoutManager layoutManager = new LinearLayoutManager(context); layoutManager.setStackFromEnd(true); // 列表从底部开始展示,反转后从上方开始展示 layoutManager.setReverseLayout(true); // 列表反转 ioItemRecyclerView.setLayoutManager(layoutManager); ioAdapter = new IOItemAdapter(ioItemList); ioItemRecyclerView.setAdapter(ioAdapter); ioTouchHelper.attachToRecyclerView(ioItemRecyclerView); }
Example 15
Source File: MessageListActivity.java From chat21-android-sdk with GNU Affero General Public License v3.0 | 5 votes |
private void initRecyclerView() { Log.d(TAG, "initRecyclerView"); mLinearLayoutManager = new LinearLayoutManager(this); mLinearLayoutManager.setStackFromEnd(true); // put adding from bottom recyclerView.setLayoutManager(mLinearLayoutManager); initRecyclerViewAdapter(recyclerView); }
Example 16
Source File: ChatFragment.java From ChatApp with Apache License 2.0 | 4 votes |
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_chat, container, false); String currentUserId = FirebaseAuth.getInstance().getCurrentUser().getUid(); // Initialize Chat Database DatabaseReference chatDatabase = FirebaseDatabase.getInstance().getReference().child("Chat").child(currentUserId); chatDatabase.keepSynced(true); // For offline use // RecyclerView related LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); linearLayoutManager.setReverseLayout(true); linearLayoutManager.setStackFromEnd(true); RecyclerView recyclerView = view.findViewById(R.id.chat_recycler); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(linearLayoutManager); DividerItemDecoration mDividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), linearLayoutManager.getOrientation()); recyclerView.addItemDecoration(mDividerItemDecoration); // Initializing adapter FirebaseRecyclerOptions<Chat> options = new FirebaseRecyclerOptions.Builder<Chat>().setQuery(chatDatabase.orderByChild("timestamp"), Chat.class).build(); adapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>(options) { @Override public ChatHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.user, parent, false); return new ChatHolder(getActivity(), view, getContext()); } @Override protected void onBindViewHolder(final ChatHolder holder, int position, final Chat model) { final String userid = getRef(position).getKey(); holder.setHolder(userid, model.getMessage(), model.getTimestamp(), model.getSeen()); holder.getView().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent chatIntent = new Intent(getContext(), ChatActivity.class); chatIntent.putExtra("userid", userid); startActivity(chatIntent); } }); } @Override public void onDataChanged() { super.onDataChanged(); TextView text = view.findViewById(R.id.f_chat_text); if(adapter.getItemCount() == 0) { text.setVisibility(View.VISIBLE); } else { text.setVisibility(View.GONE); } } }; recyclerView.setAdapter(adapter); return view; }
Example 17
Source File: BaseChatActvity.java From Android with MIT License | 4 votes |
@Override public void initView() { NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE) ; mNotificationManager.cancel(1001); talker = (Talker) getIntent().getSerializableExtra(ROOM_TALKER); roomSession = RoomSession.getInstance(); roomSession.setRoomType(talker.getTalkType()); roomSession.setRoomKey(talker.getTalkKey()); switch (talker.getTalkType()) { case 0: roomSession.setRoomName(talker.getTalkName()); roomSession.setFriendAvatar(talker.getFriendEntity().getAvatar()); baseChat = new FriendChat(talker.getFriendEntity()); if (!TextUtils.isEmpty(baseChat.address())) { UserOrderBean userOrderBean = new UserOrderBean(); userOrderBean.friendChatCookie(baseChat.roomKey()); } RecExtBean.sendRecExtMsg(RecExtBean.ExtType.BURNSTATE, roomSession.getBurntime() == 0 ? 0 : 1); break; case 1: roomSession.setRoomName(talker.getTalkName()); roomSession.setGroupEcdh(talker.getGroupEntity().getEcdh_key()); baseChat = new GroupChat(talker.getGroupEntity()); break; case 2: baseChat = RobotChat.getInstance(); roomSession.setRoomName(baseChat.nickName()); break; } linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setOrientation(OrientationHelper.VERTICAL); linearLayoutManager.setStackFromEnd(true); inputPanel = new InputPanel(getWindow().getDecorView().findViewById(android.R.id.content)); inputPanel.isGroupAt(talker.getTalkType() == 1); scrollHelper = new RecycleViewScrollHelper(new RecycleViewScrollHelper.OnScrollPositionChangedListener() { @Override public void onScrollToTop() { loadMoreMsgs(); } @Override public void onScrollToBottom() { } @Override public void onScrollToUnknown(boolean isTopViewVisible, boolean isBottomViewVisible) { } }); scrollHelper.setCheckIfItemViewFullRecycleViewForTop(true); roomEntity = ConversionHelper.getInstance().loadRoomEnitity(talker.getTalkKey()); if (roomEntity != null) { if (!TextUtils.isEmpty(roomEntity.getDraft())) { inputPanel.insertDraft(" " + roomEntity.getDraft()); } ConversionHelper.getInstance().updateRoomEntity(roomEntity); } }
Example 18
Source File: FragmentStatusCommon.java From TwrpBuilder with GNU General Public License v3.0 | 4 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_builds_common, container, false); RecyclerView lvBuilds = view.findViewById(R.id.lv_builds); Query query; if (filterQuery != null) { query = FirebaseDatabase.getInstance().getReference().child(reference).orderByChild(filterQuery).equalTo(equalTo); } else { query = FirebaseDatabase.getInstance() .getReference(reference); } query.keepSynced(true); FirebaseRecyclerOptions options = new FirebaseRecyclerOptions.Builder() .setQuery(query, Pbuild.class) .build(); adapter = new FirebaseRecyclerAdapter<Pbuild, BuildsHolder>(options) { @NonNull @Override public BuildsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.list_build_common, parent, false); if (filterQuery != null) { return new BuildsHolder(view, reference, true, getContext()); } else { return new BuildsHolder(view, reference, false, getContext()); } } @Override protected void onBindViewHolder(@NonNull BuildsHolder holder, int position, @NonNull Pbuild model) { holder.bind( model.getEmail(), model.getModel(), model.getBoard(), model.getDate(), model.getBrand(), model.getDeveloperEmail(), model.getRejector(), model.getNote(), model.getUrl()); } @Override public void onDataChanged() { super.onDataChanged(); ProgressBar(); } }; ProgressBar(); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); layoutManager.setReverseLayout(true); layoutManager.setStackFromEnd(true); lvBuilds.setLayoutManager(layoutManager); lvBuilds.setAdapter(adapter); return view; }
Example 19
Source File: InterpretationCommentsFragment.java From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { mInterpretation = new Select() .from(Interpretation.class) .where(Condition.column(Interpretation$Table .ID).is(getArguments().getLong(INTERPRETATION_ID))) .querySingle(); UserAccount account = UserAccount .getCurrentUserAccountFromDb(); mUser = new Select() .from(User.class) .where(Condition.column(User$Table .UID).is(account.getUId())) .querySingle(); ButterKnife.bind(this, view); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mAdapter = new InterpretationCommentsAdapter(getActivity(), LayoutInflater.from(getActivity()), this, mUser); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); linearLayoutManager.setStackFromEnd(true); mRecyclerView.setLayoutManager(linearLayoutManager); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setAdapter(mAdapter); Drawable buttonIcon = ContextCompat.getDrawable( getActivity(), R.mipmap.ic_comment_send); DrawableCompat.setTintList(buttonIcon, getResources() .getColorStateList(R.color.button_navy_blue_color_state_list)); mAddNewComment.setImageDrawable(buttonIcon); handleAddNewCommentButton(EMPTY_FIELD); }
Example 20
Source File: VideoCommentsFragment.java From Loop with Apache License 2.0 | 4 votes |
@Override public void onViewCreated(final View view, Bundle bundle) { super.onViewCreated(view, bundle); ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(TrestleUtility.getFormattedText(getString(R.string.comments), font)); } setUpListeners(); recyclerView.setItemAnimator(new SlideInUpAnimator()); LinearLayoutManager layoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false); layoutManager.setStackFromEnd(true); // layoutManager.setReverseLayout(true); recyclerView.setLayoutManager(layoutManager); recyclerView.setItemAnimator(new SlideInUpAnimator()); videoCommentsAdapter = new VideoCommentsAdapter(getActivity()); videoCommentsAdapter.setOnItemLongClickListener(this); // List<Comment> comments = mSale.getComments(); // if (comments != null && comments.size() > 0) { // Collections.reverse(comments); // mVideoCommentsAdapter.addAll(comments); // } recyclerView.setAdapter(videoCommentsAdapter); recyclerView.scrollToPosition(videoCommentsAdapter.getItemCount() - 1); // if (commentsCollection != null) { //// loadComments(); // // List<Comment> comments = commentsCollection.getComments(); // if (comments != null && comments.size() > 0) { // // Collections.reverse(comments); // videoCommentsAdapter.addAll(comments); // recyclerView.scrollToPosition(videoCommentsAdapter.getItemCount() - 1); //// //// mVideoCommentsAdapter.addAll(comments); // // if (comments.size() >= PAGE_SIZE) { //// mVideoCommentsAdapter.addLoading(); // } else { // isLastPage = true; // } // } // } else { // // } commentChangeObservable = RxTextView.textChanges(commentEditText); // Checks for validity of the comment input field setUpCommentSubscription(); long id = video.getId(); if (id != -1L) { loadingImageView.setVisibility(View.VISIBLE); videoId = id; Call getCommentsCall = vimeoService.getComments(videoId, sortByValue, sortOrderValue, currentPage, PAGE_SIZE); calls.add(getCommentsCall); getCommentsCall.enqueue(getCommentsFirstFetchCallback); } }