Search in sources :

Example 26 with LayoutManager

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("");
}
Also used : Song(com.wm.remusic.recent.Song) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TopTracksLoader(com.wm.remusic.recent.TopTracksLoader) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar)

Example 27 with LayoutManager

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;
}
Also used : AlbumInfo(com.wm.remusic.info.AlbumInfo) AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration) ImageView(android.widget.ImageView) TintImageView(com.bilibili.magicasakura.widgets.TintImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Example 28 with LayoutManager

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;
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Window(android.view.Window) EditText(android.widget.EditText) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Playlist(com.wm.remusic.info.Playlist) MusicInfo(com.wm.remusic.info.MusicInfo) LinearLayout(android.widget.LinearLayout)

Example 29 with LayoutManager

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;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) WindowManager(android.view.WindowManager)

Example 30 with LayoutManager

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;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)182 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)170 View (android.view.View)132 GridLayoutManager (android.support.v7.widget.GridLayoutManager)69 TextView (android.widget.TextView)60 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)44 ImageView (android.widget.ImageView)41 Bundle (android.os.Bundle)19 Nullable (android.support.annotation.Nullable)18 ViewGroup (android.view.ViewGroup)17 ArrayList (java.util.ArrayList)17 Intent (android.content.Intent)16 Toolbar (android.support.v7.widget.Toolbar)15 BindView (butterknife.BindView)15 Context (android.content.Context)14 Handler (android.os.Handler)13 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)13 DataSnapshot (com.google.firebase.database.DataSnapshot)11 DatabaseError (com.google.firebase.database.DatabaseError)11 Drawable (android.graphics.drawable.Drawable)10