本文整理汇总了Java中com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView.setAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableRecyclerView.setAdapter方法的具体用法?Java ObservableRecyclerView.setAdapter怎么用?Java ObservableRecyclerView.setAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
的用法示例。
在下文中一共展示了ObservableRecyclerView.setAdapter方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_dapil);
parsing();
mRecyclerView = (ObservableRecyclerView) findViewById(R.id.re_dapil);
mRecyclerView.setScrollViewCallbacks(this);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
mAdapter = new AdapterDapil(this, dataDapil);
mRecyclerView.setAdapter(mAdapter);
addToAdapter();
}
示例2: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_dapil);
parsing();
mRecyclerView = (ObservableRecyclerView) findViewById(R.id.re_dapil);
mRecyclerView.setScrollViewCallbacks(this);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
mAdapter = new AdapterListKomisi(this, dataKomisi);
mRecyclerView.setAdapter(mAdapter);
addToAdapter();
}
示例3: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_photos, container, false);
layoutManager = new GridLayoutManager(activity, getSpanCount());
layoutManager.setSpanSizeLookup(new HeaderSpanSizeLookup(layoutManager));
photos = (ObservableRecyclerView) rootView.findViewById(R.id.photos);
photos.setHasFixedSize(true);
photos.setLayoutManager(layoutManager);
photos.setAdapter(adapter);
photos.setScrollViewCallbacks(this);
albumId = getArguments().getString("id");
return rootView;
}
示例4: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.observable_scroll_view_activity_toolbarcontrolrecyclerview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mHeaderView = findViewById(R.id.header);
ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
mToolbarView = findViewById(R.id.toolbar);
mRecyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
mRecyclerView.setScrollViewCallbacks(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setHasFixedSize(false);
ArrayList<String> items = new ArrayList<String>();
for (int i = 1; i <= 100; i++) {
items.add("Item " + i);
}
View headerView = LayoutInflater.from(this).inflate(R.layout.observable_scroll_view_recycler_header, null);
mRecyclerView.setAdapter(new SimpleHeaderRecyclerAdapter(this, items, headerView));
}
示例5: createScrollable
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected ObservableRecyclerView createScrollable() {
ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
recyclerView.setScrollViewCallbacks(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(new CustomAdapter(this, getDummyData()));
return recyclerView;
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:10,代码来源:SlidingUpRecyclerViewActivity.java
示例6: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_handletouchrecyclerview);
ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setScrollViewCallbacks(this);
recyclerView.setAdapter(new CustomAdapter(this, getDummyData()));
}
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:12,代码来源:HandleTouchRecyclerViewActivity.java
示例7: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_trainers_list, container, false);
recyclerView = (ObservableRecyclerView) view.findViewById(R.id.rvTrainersList);
mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
((AppCompatActivity)getActivity()).setSupportActionBar(mToolbar);
((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayShowHomeEnabled(true);
mToolbar.setTitle(R.string.app_name);
// Setup Nav Drawer
drawerFragment = (NavigationDrawerFragment) getChildFragmentManager().findFragmentById(R.id.drawer_fragment);
drawerFragment.setup(view.findViewById(R.id.drawer_fragment), (CustomDrawerLayout) view.findViewById(R.id.drawerLayout), mToolbar);
// Initialize empty list
this.trainers = new ArrayList<>();
adapter = new TrainerListAdapter(getActivity(), trainers);
// allows for optimizations
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
// Setup animation
recyclerView.setScrollViewCallbacks(this);
return view;
}
示例8: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery);
application = MeizhiApplication.from(this);
DisplayMetrics metrics = getResources().getDisplayMetrics();
int actionBarHeight = getSupportActionBar().getHeight();
int swipeEndTarget = actionBarHeight + (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
refresh = (SwipeRefreshLayout) findViewById(R.id.refresh);
refresh.setColorSchemeResources(R.color.accent);
refresh.setProgressViewOffset(false, actionBarHeight, swipeEndTarget);
refresh.setOnRefreshListener(this);
adapter = new GalleryAdapter(this, this);
layoutManager = new GridLayoutManager(this, getSpanCount());
layoutManager.setSpanSizeLookup(new HeaderSpanSizeLookup(layoutManager));
albums = (ObservableRecyclerView) findViewById(R.id.albums);
albums.setHasFixedSize(true);
albums.setLayoutManager(layoutManager);
albums.setAdapter(adapter);
albums.setScrollViewCallbacks(this);
}
示例9: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.observable_scroll_view_activity_toolbarcontrolrecyclerview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mHeaderView = findViewById(R.id.header);
ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
mToolbarView = findViewById(R.id.toolbar);
mRecyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
mRecyclerView.setScrollViewCallbacks(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setHasFixedSize(false);
ArrayList<String> items = new ArrayList<String>();
for (int i = 1; i <= 100; i++) {
items.add("Item " + i);
}
View headerView = LayoutInflater.from(this).inflate(R.layout.observable_scroll_view_recycler_header, null);
mRecyclerView.setAdapter(new SimpleHeaderRecyclerAdapter(this, items, headerView));
ViewTreeObserver vto = mRecyclerView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
mRecyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
} else {
mRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
int count = mRecyclerView.getAdapter().getItemCount() - 1;
int position = count == 0 ? 1 : count > 0 ? count : 0;
mRecyclerView.scrollToPosition(position);
}
});
}
示例10: onCreate
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.observable_scroll_view_activity_actionbarcontrolrecyclerview);
ObservableRecyclerView recyclerView = (ObservableRecyclerView) findViewById(R.id.recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setHasFixedSize(true);
recyclerView.setScrollViewCallbacks(this);
ArrayList<String> items = new ArrayList<String>();
for (int i = 1; i <= 100; i++) {
items.add("Item " + i);
}
recyclerView.setAdapter(new SimpleRecyclerAdapter(this, items));
}
示例11: setupUI
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
private void setupUI() {
fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
final Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("编辑");
toolbar.setNavigationIcon(VectorDrawableUtils.getBackDrawable(getContext()));
listView = (ObservableRecyclerView) getView().findViewById(R.id.listView);
layoutManager = new LinearLayoutManager(getContext());
listView.setLayoutManager(layoutManager);
listView.setItemAnimator(null);
noteDetailAdapter = new NoteDetailAdapter();
listView.setAdapter(noteDetailAdapter);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new NoteItemTouchHelper());
itemTouchHelper.attachToRecyclerView(listView);
backgroundListView = (ListView) getView().findViewById(R.id.backgroundListView);
backgroundAdapter = new BackgroundAdapter();
backgroundListView.setAdapter(backgroundAdapter);
listView.setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
backgroundListView.setSelectionFromTop(0, -scrollY);
lastScrollY = -scrollY;
}
@Override
public void onDownMotionEvent() {
}
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
}
});
calcText();
rootView = getView().findViewById(R.id.edit_root_layout);
rootView.getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);
}
示例12: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_film_recycler_view, container, false);
imgAdd = ImageView.class.cast(view.findViewById(R.id.imgAdd));
final ObservableRecyclerView recyclerView = (ObservableRecyclerView) view.findViewById(R.id.scroll);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setHasFixedSize(false);
final View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.recycler_header, null);
final int flexibleSpaceImageHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
headerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, flexibleSpaceImageHeight));
adapter = new FilmHeaderRecyclerAdapter(this, films, headerView, new FilmHeaderRecyclerAdapter.EditAtPositionCallback() {
@Override
public void onWillEdit(FilmModel f) {
showDialogEdit(f);
}
});
recyclerView.setAdapter(adapter);
loadFilmData();
imgAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialogEdit();
}
});
// TouchInterceptionViewGroup should be a parent view other than ViewPager.
// This is a workaround for the issue #117:
// https://github.com/ksoichiro/Android-ObservableScrollView/issues/117
recyclerView.setTouchInterceptionViewGroup((ViewGroup) view.findViewById(R.id.fragment_root));
// Scroll to the specified offset after layout
Bundle args = getArguments();
if (args != null && args.containsKey(ARG_SCROLL_Y)) {
final int scrollY = args.getInt(ARG_SCROLL_Y, 0);
ScrollUtils.addOnGlobalLayoutListener(recyclerView, new Runnable() {
@Override
public void run() {
int offset = scrollY % flexibleSpaceImageHeight;
RecyclerView.LayoutManager lm = recyclerView.getLayoutManager();
if (lm != null && lm instanceof LinearLayoutManager) {
((LinearLayoutManager) lm).scrollToPositionWithOffset(0, -offset);
}
}
});
updateFlexibleSpace(scrollY, view);
} else {
updateFlexibleSpace(0, view);
}
recyclerView.setScrollViewCallbacks(this);
return view;
}
示例13: onCreateView
import com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView; //导入方法依赖的package包/类
@SuppressLint("ResourceAsColor")//Added for SwipeRefreshLayout
@Override
public View onCreateView(final LayoutInflater inflater,
final ViewGroup container, final Bundle savedInstanceState) {
init(container, savedInstanceState);
final View contentView = inflater
.inflate(R.layout.fragment_yelo_board, container, false);
mMessageDateFormatter = new DateFormatter(AppConstants.TIMESTAMP_FORMAT,
AppConstants.WALL_DATE_FORMAT);
mToolbar = (Toolbar) contentView.findViewById(R.id.my_awesome_toolbar);
Bundle extras = getArguments();
if (extras != null) {
if (extras.containsKey(AppConstants.Keys.USER_ID)) {
mUserId = extras.getString(AppConstants.Keys.USER_ID);
mUserWalls = true;
}
}
mSwipeRefreshLayout = (SwipeRefreshLayout) contentView.findViewById(R.id.swipe_container);
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setColorSchemeResources(R.color.white);
mSwipeRefreshLayout.setProgressBackgroundColor(R.color.primaryColor);
mSwipeRefreshLayout.setSize(SwipeRefreshLayout.DEFAULT);
mSwipeRefreshLayout.setEnabled(true);
mEmptyView = contentView.findViewById(R.id.empty_view);
mChangeLocationText = (TextView) mEmptyView.findViewById(R.id.change_location);
mChangeLocationText.setOnClickListener(this);
mCardListView = (ObservableRecyclerView) contentView.findViewById(R.id.yelo_board_list);
if (!mUserWalls)
mFloatActionButton = ((HomeScreenFragment) getActivity().getSupportFragmentManager().findFragmentByTag(AppConstants.FragmentTags.HOME_SCREEN)).getFabButton();
View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.padding, null);
mWallListAdapter = new WallPostAdapter(getActivity(), YeloBoardFragment.this, headerView);
mCardListView.setAdapter(mWallListAdapter);
mCardListView.setVerticalScrollBarEnabled(false);
mCardListView.setLayoutManager(new LinearLayoutManager(getActivity()));
mCardListView.setHasFixedSize(false);
/*this is added to track the scrolling down or up to show the tutorial screen overlay
accordingly. its a recycler view so we need some implementation in it.*/
addScrollerListenerForTutorial(mCardListView);
//current page is the page previously loaded for fetching the feeds from the server.
//this keeps on incrementing when the user scrolls down to load more
mCurrentpage = Integer.parseInt(SharedPreferenceHelper.getString(R.string.pref_pages_loaded, 1 + ""));
if (mUserWalls) {
//this view is for the user only feed, its a seperate activity so we show toolbar here
mToolbar.setTitleTextColor(getResources().getColor(R.color.dark_yelo));
setToolbar(mToolbar);
loadUserWallMessages();
} else {
//this view is for the main feed
loadWallMessages();
mToolbar.setVisibility(View.GONE);
}
fetchWallMessages(mCurrentpage);
return contentView;
}