Search in sources :

Example 11 with DividerItemDecoration

use of com.wm.remusic.widget.DividerItemDecoration 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");
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration) SideBar(com.wm.remusic.widget.SideBar)

Example 12 with DividerItemDecoration

use of com.wm.remusic.widget.DividerItemDecoration in project remusic by aa112901.

the class NetItemChangeActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.change_netmusic_item);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ab = getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.actionbar_back);
    ab.setDisplayHomeAsUpEnabled(true);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    TextView defaultPosition = (TextView) findViewById(R.id.default_item_position);
    // 下划线
    defaultPosition.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    // 抗锯齿
    defaultPosition.getPaint().setAntiAlias(true);
    defaultPosition.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            PreferencesUtility.getInstance(NetItemChangeActivity.this).setItemPostion("推荐歌单 最新专辑 主播电台");
        }
    });
    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    String str = PreferencesUtility.getInstance(this).getItemPosition();
    final String[] strs = str.split(" ");
    ArrayList<String> list = new ArrayList<>();
    for (String st : strs) {
        list.add(st);
    }
    mAdapter = new SelectAdapter(list);
    recyclerView.setAdapter(mAdapter);
    DragSortRecycler dragSortRecycler = new DragSortRecycler();
    dragSortRecycler.setViewHandleId(R.id.move);
    dragSortRecycler.setOnItemMovedListener(new DragSortRecycler.OnItemMovedListener() {

        @Override
        public void onItemMoved(int from, int to) {
            Log.d("queue", "onItemMoved " + from + " to " + to);
            final String str = mAdapter.getMusicAt(from);
            mAdapter.removeSongAt(from);
            mAdapter.addStringTo(to, str);
            mAdapter.notifyDataSetChanged();
            String st = "";
            for (int i = 0; i < mAdapter.strs.size(); i++) {
                if (i == mAdapter.strs.size() - 1) {
                    st = st + mAdapter.strs.get(i);
                    continue;
                }
                st = st + mAdapter.strs.get(i) + " ";
            }
            PreferencesUtility.getInstance(NetItemChangeActivity.this).setItemPostion(st);
        // MusicPlayer.moveQueueItem(from, to);
        }
    });
    recyclerView.addItemDecoration(dragSortRecycler);
    recyclerView.addOnItemTouchListener(dragSortRecycler);
    recyclerView.addOnScrollListener(dragSortRecycler.getScrollListener());
    recyclerView.setHasFixedSize(true);
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Paint(android.graphics.Paint) TextView(android.widget.TextView) DragSortRecycler(com.wm.remusic.widget.DragSortRecycler)

Example 13 with DividerItemDecoration

use of com.wm.remusic.widget.DividerItemDecoration in project remusic by aa112901.

the class AlbumFragment method setItemDecoration.

// 设置分割线
private void setItemDecoration() {
    itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
    recyclerView.addItemDecoration(itemDecoration);
}
Also used : DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration)

Example 14 with DividerItemDecoration

use of com.wm.remusic.widget.DividerItemDecoration in project remusic by aa112901.

the class ArtistFragment method setItemDecoration.

// 设置分割线
private void setItemDecoration() {
    itemDecoration = new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL_LIST);
    recyclerView.addItemDecoration(itemDecoration);
}
Also used : DividerItemDecoration(com.wm.remusic.widget.DividerItemDecoration)

Aggregations

DividerItemDecoration (com.wm.remusic.widget.DividerItemDecoration)14 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 RecyclerView (android.support.v7.widget.RecyclerView)4 View (android.view.View)4 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 Paint (android.graphics.Paint)1 Nullable (android.support.annotation.Nullable)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 SimpleItemAnimator (android.support.v7.widget.SimpleItemAnimator)1 Toolbar (android.support.v7.widget.Toolbar)1 TintImageView (com.bilibili.magicasakura.widgets.TintImageView)1 MainFragmentAdapter (com.wm.remusic.adapter.MainFragmentAdapter)1 AlbumInfo (com.wm.remusic.info.AlbumInfo)1 DragSortRecycler (com.wm.remusic.widget.DragSortRecycler)1 SideBar (com.wm.remusic.widget.SideBar)1 ArrayList (java.util.ArrayList)1