use of android.support.v7.widget.RecyclerView.LayoutManager in project remusic by aa112901.
the class RecentActivity method onCreate.
//接受歌曲播放变化和列表变化广播,刷新列表
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_recent);
// initQuickControls();
recentStore = RecentStore.getInstance(this);
TopTracksLoader recentloader = new TopTracksLoader(this, TopTracksLoader.QueryType.RecentSongs);
List<Song> recentsongs = SongLoader.getSongsForCursor(TopTracksLoader.getCursor());
int songCountInt = recentsongs.size();
mList = recentsongs;
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(RecentActivity.this), 0, 0);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle("最近播放");
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
new loadSongs().execute("");
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project remusic by aa112901.
the class AlbumDetailFragment method onCreateView.
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_common, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setLayoutManager(layoutManager);
mAdapter = new AlbumDetailAdapter(null);
recyclerView.setAdapter(mAdapter);
itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
recyclerView.addItemDecoration(itemDecoration);
recyclerView.setHasFixedSize(true);
reloadAdapter();
AlbumInfo albumInfo = MusicUtils.getAlbumInfo(mContext, albumID);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, CommonUtils.getStatusHeight(mContext), 0, 0);
((AppCompatActivity) mContext).setSupportActionBar(toolbar);
ab = ((AppCompatActivity) mContext).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(albumInfo.album_name);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (getActivity() != null)
getActivity().onBackPressed();
}
});
return view;
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project remusic by aa112901.
the class AddNetPlaylistDialog method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
//设置无标题
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
if (getArguments() != null) {
musics = getArguments().getParcelableArrayList("songs");
author = getArguments().getString("author");
}
playlistInfo = PlaylistInfo.getInstance(mContext);
playlistsManager = PlaylistsManager.getInstance(mContext);
View view = inflater.inflate(R.layout.fragment_add_playlist, container);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.create_new_playlist);
recyclerView = (RecyclerView) view.findViewById(R.id.add_playlist_recyclerview);
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog alertDialog = new AlertDialog.Builder(mContext).create();
alertDialog.setView((mContext.getLayoutInflater().inflate(R.layout.dialog, null)));
alertDialog.show();
Window window = alertDialog.getWindow();
window.setContentView(R.layout.dialog);
final EditText editText = (EditText) (window.findViewById(R.id.message));
editText.requestFocus();
(window.findViewById(R.id.positiveButton)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
alertDialog.dismiss();
}
});
(window.findViewById(R.id.negativeButton)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
new Thread(new Runnable() {
@Override
public void run() {
Log.e("addplay", "here");
String albumart = null;
for (MusicInfo info : musics) {
albumart = info.albumData;
if (info.islocal) {
if (albumart.equals(MusicUtils.getAlbumdata(MainApplication.context, info.songId)))
break;
} else if (!TextUtils.isEmpty(albumart)) {
break;
}
}
long playlistid = editText.getText().hashCode();
playlistInfo.addPlaylist(playlistid, editText.getText().toString(), musics.size(), albumart, author);
playlistsManager.insertLists(mContext, playlistid, musics);
Intent intent = new Intent(IConstants.PLAYLIST_COUNT_CHANGED);
MainApplication.context.sendBroadcast(intent);
}
}).start();
alertDialog.dismiss();
}
});
}
});
ArrayList<Playlist> playlists = playlistInfo.getPlaylist();
recyclerView.setLayoutManager(layoutManager);
AddPlaylistAdapter adapter = new AddPlaylistAdapter(playlists);
recyclerView.setAdapter(adapter);
//setItemDecoration();
return view;
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project remusic by aa112901.
the class MoreFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// try {
// mActivity = (Activity) mContext;
// } catch (Exception e) {
// e.printStackTrace();
// //说明是ApplicationContext
// }
mHandler = HandlerUtil.getInstance(mContext);
//设置无标题
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置从底部弹出
WindowManager.LayoutParams params = getDialog().getWindow().getAttributes();
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setAttributes(params);
if (getArguments() != null) {
type = getArguments().getInt("type");
args = getArguments().getString("id");
playlistId = getArguments().getLong("playlistid");
}
//布局
View view = inflater.inflate(R.layout.more_fragment, container);
topTitle = (TextView) view.findViewById(R.id.pop_list_title);
recyclerView = (RecyclerView) view.findViewById(R.id.pop_list);
layoutManager = new LinearLayoutManager(mContext);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
getList();
setClick();
setItemDecoration();
return view;
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project remusic by aa112901.
the class SearchAlbumFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable 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);
mAdapter = new AlbumAdapter(null);
recyclerView.setAdapter(mAdapter);
recyclerView.setHasFixedSize(true);
setItemDecoration();
loadAlbums();
return view;
}
Aggregations