androidx.recyclerview.widget.DefaultItemAnimator Java Examples
The following examples show how to use
androidx.recyclerview.widget.DefaultItemAnimator.
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: FriendRequests.java From Hify with MIT License | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mFirestore = FirebaseFirestore.getInstance(); mAuth = FirebaseAuth.getInstance(); mRequestView = view.findViewById(R.id.recyclerView); refreshLayout=view.findViewById(R.id.refreshLayout); requestList = new ArrayList<>(); requestAdapter = new FriendRequestAdapter(requestList, view.getContext()); mRequestView.setItemAnimator(new DefaultItemAnimator()); mRequestView.setLayoutManager(new LinearLayoutManager(view.getContext(), VERTICAL, false)); mRequestView.addItemDecoration(new DividerItemDecoration(view.getContext(),DividerItemDecoration.VERTICAL)); mRequestView.setHasFixedSize(true); mRequestView.setAdapter(requestAdapter); refreshLayout.setOnRefreshListener(this::getUsers); getUsers(); }
Example #2
Source File: GalleryNoteFragment.java From science-journal with Apache License 2.0 | 6 votes |
@Nullable @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.gallery_note_fragment, null); RecyclerView gallery = rootView.findViewById(R.id.gallery); GridLayoutManager layoutManager = new GridLayoutManager( gallery.getContext(), gallery.getContext().getResources().getInteger(R.integer.gallery_column_count)); gallery.setLayoutManager(layoutManager); gallery.setItemAnimator(new DefaultItemAnimator()); gallery.setAdapter(galleryAdapter); addButton = rootView.findViewById(R.id.btn_add); requestPermission(); attachAddButton(addButton); actionController.attachAddButton(addButton); actionController.attachProgressBar(rootView.findViewById(R.id.recording_progress_bar)); setUpTitleBar(rootView, false, R.string.action_bar_gallery, R.drawable.ic_gallery); return rootView; }
Example #3
Source File: SettingsActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ButterKnife.bind(this); setSupportActionBar(mToolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } SettingsCategoryAdapter mAdapter = new SettingsCategoryAdapter(); mAdapter.setItemCallback(this); mAdapter.addItems(constructSettingsCategories()); mCategoryList.setAdapter(mAdapter); mCategoryList.setLayoutManager(new LinearLayoutManager(getBaseContext())); mCategoryList.setItemAnimator(new DefaultItemAnimator()); }
Example #4
Source File: OmegaExpandableRecyclerView.java From OmegaRecyclerView with MIT License | 6 votes |
@Nullable private ItemAnimator requestItemAnimator() { switch (mChildExpandAnimation) { case CHILD_ANIM_DEFAULT: return new DefaultItemAnimator(); case CHILD_ANIM_DROPDOWN: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new DropDownItemAnimator(); } else { Log.e(TAG, "DropDownItemAnimator supported only since Lollipop"); return new DefaultItemAnimator(); } case CHILD_ANIM_FADE: return new FadeItemAnimator(); } return null; }
Example #5
Source File: BrickFragment.java From brickkit-android with Apache License 2.0 | 6 votes |
@Override @CallSuper public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; if (orientation() == OrientationHelper.VERTICAL) { view = inflater.inflate(R.layout.vertical_fragment_brick, container, false); } else { view = inflater.inflate(R.layout.horizontal_fragment_brick, container, false); } RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setBackgroundColor(recyclerViewBackground); ((DefaultItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false); dataManager.setRecyclerView(getContext(), recyclerView, orientation(), reverse(), view); return view; }
Example #6
Source File: HomeFragment.java From candybar with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mManager = new StaggeredGridLayoutManager( getActivity().getResources().getInteger(R.integer.home_column_count), StaggeredGridLayoutManager.VERTICAL); mRecyclerView.setHasFixedSize(true); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(mManager); if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) { int padding = getActivity().getResources().getDimensionPixelSize(R.dimen.card_margin); mRecyclerView.setPadding(padding, padding, 0, 0); } initHome(); }
Example #7
Source File: MainActivity.java From weather with Apache License 2.0 | 6 votes |
private void initRecyclerView() { LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); mItemAdapter = new ItemAdapter<>(); mFastAdapter = FastAdapter.with(mItemAdapter); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mFastAdapter); recyclerView.setFocusable(false); mFastAdapter.withOnClickListener(new OnClickListener<FiveDayWeather>() { @Override public boolean onClick(@Nullable View v, @NonNull IAdapter<FiveDayWeather> adapter, @NonNull FiveDayWeather item, int position) { Intent intent = new Intent(MainActivity.this, HourlyActivity.class); intent.putExtra(Constants.FIVE_DAY_WEATHER_ITEM, item); startActivity(intent); return true; } }); }
Example #8
Source File: FeedFragment.java From Instagram-Profile-Downloader with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_feed, container, false); recyclerView = view.findViewById(R.id.recycler_view); storiesRecyclerView = view.findViewById(R.id.storiesRecyclerView); noDataText = view.findViewById(R.id.noDataText); feedAdapter = new FeedAdapter(getActivity(),recyclerView); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(feedAdapter); if (edgeList != null && edgeList.size() > 0) feedAdapter.setEdges(edgeList); if (!TextUtils.isEmpty(username)) { showLoading(); new RequestInstagramAPI(ApiUtils.getUsernameUrl(username)).execute(); } else { noDataText.setVisibility(View.VISIBLE); } return view; }
Example #9
Source File: NetKeysActivity.java From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void setupSelectNetKeyUi() { setContentView(R.layout.activity_keys); //Bind ui ButterKnife.bind(this); netKeysRecyclerView.setLayoutManager(new LinearLayoutManager(this)); netKeysRecyclerView.setItemAnimator(new DefaultItemAnimator()); final Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); //noinspection ConstantConditions getSupportActionBar().setTitle(R.string.title_manage_net_keys); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.title_select_net_key); fab.hide(); mAdapter = new ManageNetKeyAdapter(this, mViewModel.getSelectedMeshNode(), mViewModel.getNetworkLiveData().getNetworkKeys()); mAdapter.setOnItemClickListener(this); netKeysRecyclerView.setAdapter(mAdapter); }
Example #10
Source File: FavoriteFragment.java From memorize with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_favorite, container, false); mRecyclerView = root.findViewById(R.id.fav_recycler_view); mRecyclerView.setHasFixedSize(true); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new LinearLayoutManager(AppMain.getContext(), LinearLayoutManager.VERTICAL, false)); SnapHelper snapHelper = new LinearSnapHelper(); snapHelper.attachToRecyclerView(mRecyclerView); mRecyclerView.setAdapter(mAdapter); swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.fav_swiper); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { presenter.loadWords(false); } }); // animation = AnimationUtils.loadAnimation(AppMain.getContext(), R.anim.card_in); return root; }
Example #11
Source File: OptionsFragment.java From memorize with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_options, container, false); prgLoading = (TSProgressBar) rootView.findViewById(R.id.options_progress); titleId = getResources().getStringArray(R.array.title); subtitleId = getResources().getStringArray(R.array.subtitle); userText = rootView.findViewById(R.id.user_name); userAvatar = rootView.findViewById(R.id.user_avatar); final RecyclerView mRecyclerView = rootView.findViewById(R.id.options_rv); mRecyclerView.setHasFixedSize(true); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(AppMain.getContext()); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(mLayoutManager); RecyclerView.Adapter mAdapter = new OptionsAdapter(titleId, subtitleId, imageId); mRecyclerView.setAdapter(mAdapter); ImageLoader imageLoader = new ImageLoader(AppMain.getContext()); return rootView; }
Example #12
Source File: SettingsActivity.java From Twire with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ButterKnife.bind(this); setSupportActionBar(mToolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } SettingsCategoryAdapter mAdapter = new SettingsCategoryAdapter(); mAdapter.setItemCallback(this); mAdapter.addItems(constructSettingsCategories()); mCategoryList.setAdapter(mAdapter); mCategoryList.setLayoutManager(new LinearLayoutManager(getBaseContext())); mCategoryList.setItemAnimator(new DefaultItemAnimator()); }
Example #13
Source File: MainActivity.java From prebid-mobile-android with Apache License 2.0 | 5 votes |
private void setupSettingsList() { SettingsAdapter adapter = new SettingsAdapter(this); mListView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); mListView.setItemAnimator(new DefaultItemAnimator()); mListView.setAdapter(adapter); }
Example #14
Source File: TripHistory.java From UberClone with MIT License | 5 votes |
private void initRecyclerView(){ rvHistory = findViewById(R.id.rvHistory); rvHistory.setHasFixedSize(true); layoutManager = new LinearLayoutManager(this); rvHistory.setLayoutManager(layoutManager); rvHistory.setItemAnimator(new DefaultItemAnimator()); rvHistory.addItemDecoration(new DividerItemDecoration(getApplicationContext(),LinearLayoutManager.VERTICAL)); }
Example #15
Source File: ChattingActivity.java From Audio-Recording-Animation with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chatting); getSupportActionBar().hide(); audioRecordView = new AudioRecordView(); // this is to make your layout the root of audio record view, root layout supposed to be empty.. audioRecordView.initView((FrameLayout) findViewById(R.id.layoutMain)); // this is to provide the container layout to the audio record view.. View containerView = audioRecordView.setContainerView(R.layout.layout_chatting); audioRecordView.setRecordingListener(this); recyclerViewMessages = containerView.findViewById(R.id.recyclerViewMessages); messageAdapter = new MessageAdapter(); recyclerViewMessages.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); recyclerViewMessages.setHasFixedSize(false); recyclerViewMessages.setAdapter(messageAdapter); recyclerViewMessages.setItemAnimator(new DefaultItemAnimator()); setListener(); audioRecordView.getMessageView().requestFocus(); containerView.findViewById(R.id.imageViewTitleIcon).setOnClickListener(this); containerView.findViewById(R.id.imageViewMenu).setOnClickListener(this); audioRecordView.setAttachmentOptions(AttachmentOption.getDefaultList(), this); audioRecordView.removeAttachmentOptionAnimation(false); }
Example #16
Source File: TripHistory.java From UberClone with MIT License | 5 votes |
private void initRecyclerView(){ rvHistory = findViewById(R.id.rvHistory); rvHistory.setHasFixedSize(true); layoutManager = new LinearLayoutManager(this); rvHistory.setLayoutManager(layoutManager); rvHistory.setItemAnimator(new DefaultItemAnimator()); rvHistory.addItemDecoration(new DividerItemDecoration(getApplicationContext(),LinearLayoutManager.VERTICAL)); }
Example #17
Source File: FormBuildHelper.java From SSForms with GNU General Public License v3.0 | 5 votes |
public FormBuildHelper(Context context, Activity activity, RecyclerView recyclerView, FragmentManager fragmentManager) { // initialize form adapter this.mFormAdapter = new FormAdapter(context, activity, fragmentManager); // 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 #18
Source File: SettingsFragment.java From candybar with Apache License 2.0 | 5 votes |
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); initSettings(); }
Example #19
Source File: SettingActivity.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override protected void initData() { mBinding = (ActivitySettingBinding) mViewDataBinding; mBinding.settingRv.setLayoutManager(new LinearLayoutManager(this)); mBinding.settingRv.setItemAnimator(new DefaultItemAnimator()); List<String> titles = new ArrayList<>(); titles.add(SettingConstants.CHART_SETTING); titles.add(TRANSACTION_SETTING); titles.add(OPTIONAL_SETTING); titles.add(SYSTEM_SETTING); List<SettingEntity> settingEntities = new ArrayList<>(); SettingEntity settingEntity = new SettingEntity(); settingEntity.setContent(SettingConstants.CHART_SETTING); settingEntity.setIcon(R.mipmap.ic_timeline_white_24dp); settingEntity.setJump(true); SettingEntity settingEntity1 = new SettingEntity(); settingEntity1.setContent(TRANSACTION_SETTING); settingEntity1.setIcon(R.mipmap.ic_speaker_notes_white_24dp); settingEntity1.setJump(true); SettingEntity settingEntity2 = new SettingEntity(); settingEntity2.setContent(SYSTEM_SETTING); settingEntity2.setIcon(R.mipmap.ic_backup_white_24dp); settingEntity2.setJump(true); settingEntities.add(settingEntity); settingEntities.add(settingEntity1); settingEntities.add(settingEntity2); mSettingAdapter = new SettingAdapter(this, settingEntities); mBinding.settingRv.setAdapter(mSettingAdapter); }
Example #20
Source File: TestResultsActivity.java From prebid-mobile-android with Apache License 2.0 | 5 votes |
private void setupResultsList() { TestResultsAdapter adapter = new TestResultsAdapter(); mListView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false)); mListView.setItemAnimator(new DefaultItemAnimator()); mListView.setAdapter(adapter); }
Example #21
Source File: BankTransferActivity.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override protected void initData() { mBinding = (ActivityBankTransferBinding) mViewDataBinding; mIsUpdate = true; mOldData = new ArrayList<>(); mNewData = new ArrayList<>(); mBinding.rv.setLayoutManager(new LinearLayoutManager(this)); mBinding.rv.addItemDecoration( new DividerItemDecorationUtils(this, DividerItemDecorationUtils.VERTICAL_LIST)); mBinding.rv.setItemAnimator(new DefaultItemAnimator()); mAdapter = new BankTransferAdapter(this, mOldData); mBinding.rv.setAdapter(mAdapter); mBankId = new HashMap<>(); List<String> bankList = new ArrayList<>(); List<String> currencyList = new ArrayList<>(); mBankSpinnerAdapter = new ArrayAdapter<>(this, R.layout.spinner_display_style, R.id.tv_Spinner, bankList); mBankSpinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_style); mBinding.spinnerBank.setAdapter(mBankSpinnerAdapter); mCurrencySpinnerAdapter = new ArrayAdapter<>(this, R.layout.spinner_display_style, R.id.tv_Spinner, currencyList); mCurrencySpinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_style); mBinding.spinnerCurrency.setAdapter(mCurrencySpinnerAdapter); if (TRANSFER_IN.equals(mTitle)) mBinding.futureBank.setVisibility(View.GONE); if (TRANSFER_OUT.equals(mTitle)) mBinding.bankFuture.setVisibility(View.GONE); }
Example #22
Source File: ManagerConditionOrderActivity.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override protected void initData() { mBinding = (ActivityManagerConditionOrderBinding) mViewDataBinding; sContext = BaseApplication.getContext(); mBinding.rv.setLayoutManager(new LinearLayoutManager(this)); mBinding.rv.addItemDecoration( new DividerItemDecorationUtils(this, DividerItemDecorationUtils.VERTICAL_LIST)); mBinding.rv.setItemAnimator(new DefaultItemAnimator()); mAdapter = new ConditionOrderAdapter(this, mOldData); mBinding.rv.setAdapter(mAdapter); }
Example #23
Source File: HistoryConditionActivity.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
@Override protected void initData() { mBinding = (ActivityHistoryConditionBinding) mViewDataBinding; sContext = BaseApplication.getContext(); mBinding.rv.setLayoutManager(new LinearLayoutManager(this)); mBinding.rv.addItemDecoration( new DividerItemDecorationUtils(this, DividerItemDecorationUtils.VERTICAL_LIST)); mBinding.rv.setItemAnimator(new DefaultItemAnimator()); mAdapter = new ConditionOrderAdapter(this, mOldData); mBinding.rv.setAdapter(mAdapter); mBinding.textViewActionDay.setText( TimeUtils.date2String(Calendar.getInstance().getTime(), YMD_FORMAT_4)); }
Example #24
Source File: ArmsUtils.java From MVPArms with Apache License 2.0 | 5 votes |
/** * 配置 RecyclerView * * @param recyclerView * @param layoutManager * @deprecated Use {@link #configRecyclerView(RecyclerView, RecyclerView.LayoutManager)} instead */ @Deprecated public static void configRecycleView(final RecyclerView recyclerView , RecyclerView.LayoutManager layoutManager) { recyclerView.setLayoutManager(layoutManager); //如果可以确定每个item的高度是固定的,设置这个选项可以提高性能 recyclerView.setHasFixedSize(true); recyclerView.setItemAnimator(new DefaultItemAnimator()); }
Example #25
Source File: GirlFragment.java From Girls with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_fragment, null); mRecyclerView = rootView.findViewById(R.id.activity_recycke_view); //设置布局管理器,2表示两列,并且是竖直方向的瀑布流 StaggeredGridLayoutManager mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mStaggeredGridLayoutManager); //设置adapter mRecyclerView.setAdapter(mGirlAdapter); mRecyclerView.setHasFixedSize(true); //设置Item增加、移除动画 mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mFloatingActionButton = rootView.findViewById(R.id.fab_girl); mFloatingActionButton.attachToRecyclerView(mRecyclerView); mCircularProgressBar = rootView.findViewById(R.id.circular_progressbar); swipeRefreshLayout = rootView.findViewById(R.id.swipeRefreshLayout); swipeRefreshLayout.setColorSchemeColors( getResources().getColor(R.color.holo_red_light), getResources().getColor(R.color.holo_green_light), getResources().getColor(R.color.holo_blue_bright)); //swipeRefreshLayout 设置下拉刷新事件 swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { getData(); //成功了 关闭刷新 swipeRefreshLayout.setRefreshing(false); } }); return rootView; }
Example #26
Source File: QuoteFragment.java From shinny-futures-android with GNU General Public License v3.0 | 5 votes |
private void initData() { mToolbarTitle = getActivity().findViewById(R.id.title_toolbar); mBinding.rvQuote.setLayoutManager(new LinearLayoutManager(getActivity())); mBinding.rvQuote.addItemDecoration( new DividerItemDecorationUtils(getActivity(), DividerItemDecorationUtils.VERTICAL_LIST)); mBinding.rvQuote.setItemAnimator(new DefaultItemAnimator()); mAdapter = new QuoteAdapter(getActivity(), mOldData, mTitle); mBinding.rvQuote.setAdapter(mAdapter); }
Example #27
Source File: Notifications.java From Hify with MIT License | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewPump.init(ViewPump.builder() .addInterceptor(new CalligraphyInterceptor( new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/bold.ttf") .setFontAttrId(R.attr.fontPath) .build())) .build()); setContentView(R.layout.activity_notifications); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); mRecyclerView = findViewById(R.id.recyclerView); refreshLayout=findViewById(R.id.refreshLayout); notificationsList = new ArrayList<>(); notificationsAdapter = new NotificationsAdapter(notificationsList, this); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new LinearLayoutManager(this, VERTICAL, false)); mRecyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL)); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(notificationsAdapter); refreshLayout.setOnRefreshListener(() -> getNotifications()); getNotifications(); }
Example #28
Source File: CommentsActivity.java From Hify with MIT License | 5 votes |
private void setupCommentView() { user_id = getIntent().getStringExtra("user_id"); post_id = getIntent().getStringExtra("post_id"); post_desc.setText(Html.fromHtml(getIntent().getStringExtra("post_desc"))); owner=getIntent().getBooleanExtra("owner",false); mFirestore.collection("Users") .document(user_id) .get() .addOnSuccessListener(documentSnapshot -> Glide.with(CommentsActivity.this) .setDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.default_profile_picture)) .load( documentSnapshot.getString("image")) .into(user_image)) .addOnFailureListener(e -> Log.e("error",e.getLocalizedMessage())); mCommentsRecycler = findViewById(R.id.recyclerView); mCommentText = findViewById(R.id.text); mCommentsSend = findViewById(R.id.send); mProgress = findViewById(R.id.progressBar); commentList = new ArrayList<>(); mAdapter = new CommentsAdapter(commentList, this,owner); mCommentsSend.setOnClickListener(view -> { String comment = mCommentText.getText().toString(); if (!TextUtils.isEmpty(comment)) sendComment(comment, mCommentText, mProgress); else AnimationUtil.shakeView(mCommentText, CommentsActivity.this); }); mCommentsRecycler.setItemAnimator(new DefaultItemAnimator()); mCommentsRecycler.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); mCommentsRecycler.setLayoutManager(new LinearLayoutManager(this)); mCommentsRecycler.setHasFixedSize(true); mCommentsRecycler.setAdapter(mAdapter); getComments(mProgress); }
Example #29
Source File: FriendProfile.java From Hify with MIT License | 5 votes |
@Override public void onViewCreated(View view,@Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle bundle = this.getArguments(); if (bundle != null) { id = bundle.getString("id"); }else{ Toasty.error(rootView.getContext(), "Error retrieving information.", Toasty.LENGTH_SHORT,true).show(); getActivity().finish(); } refreshLayout=rootView.findViewById(R.id.refreshLayout); statsheetView = ((AppCompatActivity)getActivity()).getLayoutInflater().inflate(R.layout.stat_bottom_sheet_dialog, null); mmBottomSheetDialog = new BottomSheetDialog(rootView.getContext()); mmBottomSheetDialog.setContentView(statsheetView); mmBottomSheetDialog.setCanceledOnTouchOutside(true); postList=new ArrayList<>(); mAdapter=new PostsAdapter(postList, rootView.getContext(),getActivity(),mmBottomSheetDialog,statsheetView,false); mRecyclerView=rootView.findViewById(R.id.recyclerView); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.setLayoutManager(new LinearLayoutManager(rootView.getContext(), VERTICAL, false)); mRecyclerView.addItemDecoration(new DividerItemDecoration(view.getContext(),DividerItemDecoration.VERTICAL)); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(mAdapter); refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { postList.clear(); mAdapter.notifyDataSetChanged(); getPosts(id); } }); getPosts(id); }
Example #30
Source File: MovieListFragment.java From androidMvvm with MIT License | 5 votes |
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view= inflater.inflate(R.layout.movie_list_fragment, container, false); recyclerView = (RecyclerView)view.findViewById(R.id.recycler_view); mAdapter = new MoviesAdapter(movieList); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setAdapter(mAdapter); return view; }