use of com.wm.remusic.widget.SideBar in project remusic by aa112901.
the class FolderFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recylerview, container, false);
// folderInfos = MusicUtils.queryFolder(mContext);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new Adapter(null);
recyclerView.setAdapter(mAdapter);
recyclerView.setHasFixedSize(true);
setItemDecoration();
isAZSort = mPreferences.getFoloerSortOrder().equals(SortOrder.FolderSortOrder.FOLDER_A_Z);
dialogText = (TextView) view.findViewById(R.id.dialog_text);
sideBar = (SideBar) view.findViewById(R.id.sidebar);
sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
dialogText.setText(s);
sideBar.setView(dialogText);
Log.e("scrol", " " + s);
if (positionMap.get(s) != null) {
int i = positionMap.get(s);
Log.e("scrolget", " " + i);
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
}
}
});
reloadAdapter();
return view;
}
use of com.wm.remusic.widget.SideBar in project remusic by aa112901.
the class AlbumFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recylerview, container, false);
isAZSort = mPreferences.getAlbumSortOrder().equals(SortOrder.AlbumSortOrder.ALBUM_A_Z);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
mAdapter = new AlbumAdapter(null);
recyclerView.setAdapter(mAdapter);
setItemDecoration();
dialogText = (TextView) view.findViewById(R.id.dialog_text);
sideBar = (SideBar) view.findViewById(R.id.sidebar);
sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
dialogText.setText(s);
sideBar.setView(dialogText);
Log.e("scrol", " " + s);
if (positionMap.get(s) != null) {
int i = positionMap.get(s);
Log.e("scrolget", " " + i);
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
}
}
});
reloadAdapter();
return view;
}
use of com.wm.remusic.widget.SideBar in project remusic by aa112901.
the class ArtistFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recylerview, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
//fastScroller = (FastScroller) view.findViewById(R.id.fastscroller);
//new loadArtists().execute("");
mAdapter = new ArtistAdapter(null);
recyclerView.setAdapter(mAdapter);
recyclerView.setHasFixedSize(true);
((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
setItemDecoration();
isAZSort = mPreferences.getArtistSortOrder().equals(SortOrder.ArtistSortOrder.ARTIST_A_Z);
dialogText = (TextView) view.findViewById(R.id.dialog_text);
sideBar = (SideBar) view.findViewById(R.id.sidebar);
sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
dialogText.setText(s);
sideBar.setView(dialogText);
Log.e("scrol", " " + s);
if (positionMap.get(s) != null) {
int i = positionMap.get(s);
Log.e("scrolget", " " + i);
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
}
}
});
reloadAdapter();
return view;
}
use of com.wm.remusic.widget.SideBar in project remusic by aa112901.
the class MusicFragment method loadView.
private void loadView() {
//setUservisibleHint 可能先与attach
if (view == null && mContext != null) {
view = LayoutInflater.from(mContext).inflate(R.layout.recylerview, frameLayout, false);
dialogText = (TextView) view.findViewById(R.id.dialog_text);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new Adapter(null);
recyclerView.setAdapter(mAdapter);
recyclerView.setHasFixedSize(true);
//fastScroller = (FastScroller) view.findViewById(R.id.fastscroller);
recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST));
sideBar = (SideBar) view.findViewById(R.id.sidebar);
sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
dialogText.setText(s);
sideBar.setView(dialogText);
if (positionMap.get(s) != null) {
int i = positionMap.get(s);
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(i + 1, 0);
}
}
});
reloadAdapter();
Log.e("MusicFragment", "load l");
}
}
Aggregations