项目:MovieApp
文件:HomeMovieLIstWrapper.java
private void init(Context context) {
inflate(context,R.layout.home_list_wrapper,this);
ButterKnife.bind(this);
linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context) {
@Override
protected int getExtraLayoutSpace(RecyclerView.State state) {
return 200;
}
};
linearlayoutmanager.setorientation(linearlayoutmanager.HORIZONTAL);
recyclerView.setLayoutManager(linearlayoutmanager);
SnapHelper SnapHelper = new GravitySnapHelper(Gravity.START);
SnapHelper.attachToRecyclerView(recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setnestedScrollingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
}
private void initgalleryWhenImagesAreAvailable() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.gallery);
recyclerView.setHasFixedSize(true);
CenterLayoutManager layoutManager = new CenterLayoutManager(context,CenterLayoutManager.HORIZONTAL,false);
SnapHelper SnapHelper = new LinearSnapHelper();
if (recyclerView.getonFlingListener() == null) {
SnapHelper.attachToRecyclerView(recyclerView);
}
recyclerView.setLayoutManager(layoutManager);
PlacesgalleryAdapter adapter = new PlacesgalleryAdapter(context,imageUrls,(ImageView) findViewById(R.id.singleImage),(TextView) findViewById(R.id.size),recyclerView,languageHelper);
if (this.onClickCallback != null) {
adapter.setCallback(this.onClickCallback);
}
recyclerView.setAdapter(adapter);
}
项目:MovieApp
文件:FullCreditFragment.java
private void init(View view) {
unbinder = ButterKnife.bind(this,view);
mActivity = (AppCompatActivity) getActivity();
mActivity.setSupportActionBar(toolbar);
ActionBar actionBar = mActivity.getSupportActionBar();
if (actionBar != null) {
actionBar.setdisplayHomeAsUpEnabled(true);
actionBar.setdisplayShowTitleEnabled(false);
}
toolbar.setBackgroundColor(color);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mActivity.getwindow().setStatusBarColor(Utils.getDarkColor(color));
}
toolbar.setTitle(title);
linearlayoutmanager layoutManager
= new linearlayoutmanager(getActivity(),linearlayoutmanager.VERTICAL,false);
recyclerView.setLayoutManager(layoutManager);
SnapHelper SnapHelper = new GravitySnapHelper(Gravity.TOP);
SnapHelper.attachToRecyclerView(recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setnestedScrollingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addItemdecoration(new DividerItemdecoration(getActivity(),DividerItemdecoration.VERTICAL));
recyclerView.setAdapter(adapter);
}
项目:MovieApp
文件:PeopleFullCreditViewPagerFragment.java
private void init(View view) {
unbinder = ButterKnife.bind(this,view);
linearlayoutmanager layoutManager
= new linearlayoutmanager(getActivity(),DividerItemdecoration.VERTICAL));
recyclerView.setAdapter(adapter);
}
项目:MovieApp
文件:SimilarMoviesWrapper.java
private void init(Context context) {
inflate(context,R.layout.detail_similar_movies_wrapper,this);
ButterKnife.bind(this);
linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context);
linearlayoutmanager.setorientation(linearlayoutmanager.HORIZONTAL);
recyclerView.setLayoutManager(linearlayoutmanager);
SnapHelper SnapHelper = new GravitySnapHelper(Gravity.START);
SnapHelper.attachToRecyclerView(recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setnestedScrollingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
}
项目:MovieApp
文件:MovieImagesWrapper.java
private void init(Context context) {
inflate(context,R.layout.detail_images_wrapper,this);
ButterKnife.bind(this);
linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context);
linearlayoutmanager.setorientation(linearlayoutmanager.HORIZONTAL);
recyclerView.setLayoutManager(linearlayoutmanager);
SnapHelper SnapHelper = new GravitySnapHelper(Gravity.END);
SnapHelper.attachToRecyclerView(recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setnestedScrollingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
}
private void init(Context context,@Nullable AttributeSet attrs) {
if (attrs != null) {
TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.MetalRecyclerViewPager,0);
itemmargin = (int) typedArray.getDimension(R.styleable.MetalRecyclerViewPager_itemmargin,0f);
typedArray.recycle();
}
setLayoutManager(new linearlayoutmanager(context,linearlayoutmanager.HORIZONTAL,false));
SnapHelper SnapHelper = new PagerSnapHelper();
SnapHelper.attachToRecyclerView(this);
}
private void init(Context context,false));
SnapHelper SnapHelper = new PagerSnapHelper();
SnapHelper.attachToRecyclerView(this);
}
项目:MusicX-music-player
文件:RecentFragment.java
@Override
protected void background() {
recentlyPlayed = new Songlistadapter(getContext());
CustomLayoutManager customLayoutManager1 = new CustomLayoutManager(getContext());
customLayoutManager1.setSmoothScrollbarEnabled(true);
customLayoutManager1.setorientation(linearlayoutmanager.HORIZONTAL);
SnapHelper startSnapHelper = new StartSnapHelper();
recentlyAdding.setLayoutManager(customLayoutManager1);
recentlyAdding.setnestedScrollingEnabled(false);
recentlyAdding.setVerticalScrollBarEnabled(false);
recentlyAdding.setHorizontalScrollBarEnabled(false);
songlistadapter.setLayoutId(R.layout.recent_list);
recentlyAdding.setScrollBarSize(0);
recentlyAdding.setAdapter(songlistadapter);
songlistadapter.setonItemClickListener(onClicks);
recentlyAdding.setItemAnimator(new DefaultItemAnimator());
recentlyAdding.setHasFixedSize(true);
startSnapHelper.attachToRecyclerView(recentlyAdding);
getLoaderManager().initLoader(trackloader,null,RecentFragment.this);
CustomLayoutManager customLayoutManager = new CustomLayoutManager(getContext());
customLayoutManager.setSmoothScrollbarEnabled(true);
customLayoutManager.setorientation(linearlayoutmanager.HORIZONTAL);
recentlyPlaying.setLayoutManager(customLayoutManager);
recentlyPlaying.setnestedScrollingEnabled(false);
recentlyPlaying.setVerticalScrollBarEnabled(false);
recentlyPlaying.setHorizontalScrollBarEnabled(false);
recentlyPlayed.setLayoutId(R.layout.recent_list);
recentlyPlaying.setScrollBarSize(0);
recentlyPlaying.setAdapter(recentlyPlayed);
recentlyPlayed.setonItemClickListener(onClick);
recentlyPlaying.setItemAnimator(new DefaultItemAnimator());
recentlyPlaying.setHasFixedSize(true);
startSnapHelper.attachToRecyclerView(recentlyPlaying);
getLoaderManager().initLoader(recentloader,recentPlaying);
}
private void init(Context context,false));
SnapHelper SnapHelper = new PagerSnapHelper();
SnapHelper.attachToRecyclerView(this);
}
项目:RetroMusicPlayer
文件:HomeAdapter.java
private void parseAllSections(int i,ViewHolder viewholder) {
if (viewholder.recyclerView != null) {
SnapHelper SnapHelper = new LinearSnapHelper();
viewholder.recyclerView.setonFlingListener(null);
SnapHelper.attachToRecyclerView(viewholder.recyclerView);
ArrayList arrayList = (ArrayList) dataSet.get(i);
if (arrayList.isEmpty()) {
return;
}
Object something = arrayList.get(0);
if (something instanceof Artist) {
viewholder.recyclerView.setLayoutManager(new GridLayoutManager(activity,1,GridLayoutManager.HORIZONTAL,false));
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
viewholder.recyclerView.setAdapter(new ArtistAdapter(activity,(ArrayList<Artist>) arrayList,R.layout.item_artist,false,null));
} else if (something instanceof Album) {
viewholder.recyclerView.setLayoutManager(new GridLayoutManager(activity,false));
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
viewholder.recyclerView.setAdapter(new AlbumAdapter(activity,(ArrayList<Album>) arrayList,R.layout.pager_item,null));
} else if (something instanceof Playlist) {
viewholder.recyclerView.setLayoutManager(new linearlayoutmanager(activity));
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
viewholder.recyclerView.setAdapter(new Playlistadapter(activity,(ArrayList<Playlist>) arrayList,R.layout.item_list,null));
} else if (something instanceof Song) {
GridLayoutManager layoutManager = new GridLayoutManager(activity,false);
viewholder.recyclerView.setLayoutManager(layoutManager);
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
viewholder.recyclerView.setAdapter(new SongAdapter(activity,(ArrayList<Song>) arrayList,R.layout.item_image,null));
}
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_discover_games,container,false);
GridLayoutManager popularGamesLayoutManager = new GridLayoutManager(getContext(),false);
GridLayoutManager mostAnticipatedGamesLayoutManager = new GridLayoutManager(getContext(),false);
GridLayoutManager upcomingGamesLayoutManager = new GridLayoutManager(getContext(),false);
RecyclerView popularGamesRecyclerView = (RecyclerView) view.findViewById(R.id.popular_games_list);
RecyclerView mostAnticipatedGamesRecyclerView = (RecyclerView) view.findViewById(R.id.most_anticipated_games_list);
RecyclerView upcomingGamesRecyclerView = (RecyclerView) view.findViewById(R.id.upcoming_games_list);
mContent = (RelativeLayout) view.findViewById(R.id.content);
mContentLoading = (RelativeLayout) view.findViewById(R.id.content_loading_progress);
// Todo: check https://github.com/rubensousa/RecyclerViewSnap
SnapHelper helper = new LinearSnapHelper();
helper.attachToRecyclerView(popularGamesRecyclerView);
helper.attachToRecyclerView(mostAnticipatedGamesRecyclerView);
helper.attachToRecyclerView(upcomingGamesRecyclerView);
popularGamesRecyclerView.setLayoutManager(popularGamesLayoutManager);
popularGamesRecyclerView.setAdapter(mPopularGamesAdapter);
mostAnticipatedGamesRecyclerView.setLayoutManager(mostAnticipatedGamesLayoutManager);
mostAnticipatedGamesRecyclerView.setAdapter(mMostAnticipatedGamesAdapter);
upcomingGamesRecyclerView.setLayoutManager(upcomingGamesLayoutManager);
upcomingGamesRecyclerView.setAdapter(mUpcomingGamesAdapter);
return view;
}
private void setupSectionView(RecyclerView recyclerView,@SectionVO.Type int type) {
recyclerView.setLayoutManager(new linearlayoutmanager(this,false));
recyclerView.setnestedScrollingEnabled(false);
recyclerView.setHasFixedSize(true);
SectionAdapter adapter = new SectionAdapter(this,type,this);
recyclerView.setAdapter(adapter);
SnapHelper SnapHelper = new LinearSnapHelper();
SnapHelper.attachToRecyclerView(recyclerView);
}
项目:Nearby-Shops-End-User-Android-app
文件:ShopMapFragment.java
void setupRecyclerView()
{
adapter = new AdapterHorizontal(dataset,getActivity(),this);
reviewsList.setAdapter(adapter);
linearlayoutmanager = new linearlayoutmanager(getActivity(),false);
reviewsList.setLayoutManager(linearlayoutmanager);
SnapHelper helper = new LinearSnapHelper();
// helper.onFling(10,10);
helper.attachToRecyclerView(reviewsList);
reviewsList.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView,int dx,int dy) {
super.onScrolled(recyclerView,dx,dy);
if(dataset!=null && dataset.size()>0)
{
int position = linearlayoutmanager.findFirstVisibleItemPosition();
if(position!=RecyclerView.NO_POSITION)
{
notifyListItemClick(position);
}
}
}
});
}
项目:CutoutViewIndicator
文件:VerticalDotsFragment.java
private void initRecycler(@NonNull RecyclerView recyclerView) {
linearlayoutmanager layoutManager = new linearlayoutmanager(recyclerView.getContext(),VERTICAL,false);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(new multicoloredAdapter(getChildQuantity(),getChildLayoutId()));
SnapHelper helper = new LinearSnapHelper();
helper.attachToRecyclerView(recyclerView);
}
private void initRecyclerView() {
matrixApiLocationRecyclerViewAdapter = new MatrixApiLocationRecyclerViewAdapter(this,matrixLocationList);
recyclerView.setLayoutManager(new linearlayoutmanager(getApplicationContext(),true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(matrixApiLocationRecyclerViewAdapter);
SnapHelper SnapHelper = new LinearSnapHelper();
SnapHelper.attachToRecyclerView(recyclerView);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// MapBox access token is configured here. This needs to be called either in your application
// object or in the same activity which contains the mapview.
MapBox.getInstance(this,getString(R.string.access_token));
// This contains the MapView in XML and needs to be called after the access token is configured.
setContentView(R.layout.activity_lab_recycler_view_on_map);
recyclerView = (RecyclerView) findViewById(R.id.rv_on_top_of_map);
Toast.makeText(this,R.string.toast_instruction,Toast.LENGTH_SHORT).show();
// Initialize the map view
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapBoxMap mapBoxMap) {
RecyclerViewOnMapActivity.this.mapBoxMap = mapBoxMap;
setUpLists();
// Set up the recyclerView
locationAdapter = new LocationRecyclerViewAdapter(locationList,mapBoxMap);
recyclerView.setLayoutManager(new linearlayoutmanager(getApplicationContext(),true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(locationAdapter);
SnapHelper SnapHelper = new LinearSnapHelper();
SnapHelper.attachToRecyclerView(recyclerView);
}
});
}
项目:MusicX-music-player
文件:ArtistFragment.java
@Override
protected void background() {
songlistadapter.setLayoutId(R.layout.song_list);
albumlistadapter = new Albumlistadapter(getContext());
albumlistadapter.setLayoutID(R.layout.recent_list);
SnapHelper startSnapHelper = new StartSnapHelper();
CustomLayoutManager customLayoutManager = new CustomLayoutManager(getContext());
customLayoutManager.setSmoothScrollbarEnabled(true);
customLayoutManager.setorientation(CustomLayoutManager.HORIZONTAL);
albumrv.setAdapter(albumlistadapter);
albumrv.setLayoutManager(customLayoutManager);
albumrv.setHasFixedSize(true);
albumrv.setnestedScrollingEnabled(false);
albumrv.setVerticalScrollBarEnabled(false);
albumrv.setHorizontalScrollBarEnabled(false);
albumrv.setScrollBarSize(0);
startSnapHelper.attachToRecyclerView(albumrv);
CustomLayoutManager c = new CustomLayoutManager(getContext());
c.setSmoothScrollbarEnabled(true);
rv.setAdapter(songlistadapter);
rv.addItemdecoration(new DividerItemdecoration(getContext(),75,false));
rv.setLayoutManager(c);
rv.setHasFixedSize(true);
songlistadapter.setonItemClickListener(mOnClick);
songlistadapter.setonLongClickListener(onLongClick);
albumlistadapter.setonItemClickListener(mOnClickAlbum);
loadTrak();
if (((MainActivity) getActivity()) != null) {
AppCompatActivity appCompatActivity = ((MainActivity) getActivity());
if (appCompatActivity != null && appCompatActivity.getSupportActionBar() != null) {
appCompatActivity.getSupportActionBar().setdisplayHomeAsUpEnabled(true);
appCompatActivity.setSupportActionBar(toolbar);
}
}
}
项目:MusicX-music-player
文件:Playing2Fragment.java
@Override
protected void function() {
mPlayLayout.fastopen();
mPlayLayout.getIvSkipNext().setimageResource(R.drawable.aw_ic_next);
mPlayLayout.getIvSkipPrevIoUs().setimageResource(R.drawable.aw_ic_prev);
ateKey = Helper.getATEKey(getContext());
accentColor = Config.accentColor(getContext(),ateKey);
mPlayLayout.setPlayButtonBackgroundTintList(ColorStateList.valueOf(accentColor));
moreMenu.setonClickListener(mOnClickListener);
if (getActivity() == null || getActivity().getwindow() == null) {
return;
}
moreMenu.setimageDrawable(ContextCompat.getDrawable(getContext(),R.drawable.ic_menu));
favhelper = new FavHelper(getContext());
favButton.setonClickListener(mOnClickListener);
CustomLayoutManager customlayoutmanager = new CustomLayoutManager(getContext());
customlayoutmanager.setorientation(linearlayoutmanager.HORIZONTAL);
queuerv.setLayoutManager(customlayoutmanager);
SnapHelper startSnapHelper = new StartSnapHelper();
startSnapHelper.attachToRecyclerView(queuerv);
queuerv.setHasFixedSize(true);
queueAdapter = new QueueAdapter(getContext(),this);
queueAdapter.setLayoutId(R.layout.gridqueue);
queuerv.setAdapter(queueAdapter);
queueAdapter.setonItemClickListener(onClick);
itemtouchhelper.Callback callback = new SimpleitemtouchhelperCallback(queueAdapter);
mitemtouchhelper = new itemtouchhelper(callback);
mitemtouchhelper.attachToRecyclerView(queuerv);
if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) {
mPlayLayout.setProgressLineColor(ContextCompat.getColor(getContext(),R.color.translucent_white_8p));
} else {
mPlayLayout.setProgressLineColor(ContextCompat.getColor(getContext(),R.color.translucent_white_8p));
}
getActivity().getwindow().setStatusBarColor(accentColor);
/**
* Show Case
*/
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500);
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(getActivity(),"400");
sequence.setConfig(config);
sequence.addSequenceItem(queuerv,"Slide right/left to view Lyrics/PlayingView","GOT IT");
sequence.setonItemdismissedListener(new MaterialShowcaseSequence.OnSequenceItemdismissedListener() {
@Override
public void ondismiss(MaterialShowcaseView materialShowcaseView,int i) {
materialShowcaseView.hide();
}
});
sequence.start();
helper = new Helper(getContext());
startVisualiser();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。