Search in sources :

Example 36 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project YourAppIdea by Michenux.

the class FriendListFragment method onCreateView.

/**
     * {@inheritDoc}
     *
     * @see android.support.v4.app.ListFragment#onCreateView(android.view.LayoutInflater,
     * android.view.ViewGroup, android.os.Bundle)
     */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mainView = inflater.inflate(R.layout.friendlist, container, false);
    mRecyclerView = (RecyclerView) mainView.findViewById(R.id.friend_recyclerview);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLongClickable(false);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    linearLayoutManager.setOrientation(OrientationHelper.VERTICAL);
    mRecyclerView.setLayoutManager(linearLayoutManager);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), null));
    ItemClickSupport.addTo(mRecyclerView).setOnItemClickListener(this);
    fillData();
    return mainView;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(org.michenux.drodrolib.ui.recyclerview.DividerItemDecoration) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 37 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project XRecyclerView by jianghejie.

the class ItemDecorationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recyclerview);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mRecyclerView = (XRecyclerView) this.findViewById(R.id.recyclerview);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(layoutManager);
    Drawable dividerDrawable = ContextCompat.getDrawable(this, R.drawable.divider_sample);
    mRecyclerView.addItemDecoration(mRecyclerView.new DividerItemDecoration(dividerDrawable));
    mRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
    mRecyclerView.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
    mRecyclerView.setArrowImageView(R.drawable.iconfont_downgrey);
    View header = LayoutInflater.from(this).inflate(R.layout.recyclerview_header, (ViewGroup) findViewById(android.R.id.content), false);
    mRecyclerView.addHeaderView(header);
    mRecyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {

        @Override
        public void onRefresh() {
            refreshTime++;
            times = 0;
            new Handler().postDelayed(new Runnable() {

                public void run() {
                    listData.clear();
                    for (int i = 0; i < 15; i++) {
                        listData.add("item" + i + "after " + refreshTime + " times of refresh");
                    }
                    mAdapter.notifyDataSetChanged();
                    mRecyclerView.refreshComplete();
                }
            }, // refresh data here
            1000);
        }

        @Override
        public void onLoadMore() {
            if (times < 2) {
                new Handler().postDelayed(new Runnable() {

                    public void run() {
                        for (int i = 0; i < 15; i++) {
                            listData.add("item" + (1 + listData.size()));
                        }
                        mRecyclerView.loadMoreComplete();
                        mAdapter.notifyDataSetChanged();
                    }
                }, 1000);
            } else {
                new Handler().postDelayed(new Runnable() {

                    public void run() {
                        for (int i = 0; i < 9; i++) {
                            listData.add("item" + (1 + listData.size()));
                        }
                        mRecyclerView.setNoMore(true);
                        mAdapter.notifyDataSetChanged();
                    }
                }, 1000);
            }
            times++;
        }
    });
    listData = new ArrayList<String>();
    for (int i = 0; i < 15; i++) {
        listData.add("item" + i);
    }
    mAdapter = new MyAdapter(listData);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.refresh();
}
Also used : Drawable(android.graphics.drawable.Drawable) Handler(android.os.Handler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.jcodecraeer.xrecyclerview.XRecyclerView.DividerItemDecoration) XRecyclerView(com.jcodecraeer.xrecyclerview.XRecyclerView) View(android.view.View) XRecyclerView(com.jcodecraeer.xrecyclerview.XRecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Example 38 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project MyJapanese by 54wall.

the class LessonsFragment method setData.

@Override
public void setData(List<Book> data) {
    // 来自initAdapter
    mBookList = data;
    leftAdapter = new LeftMenuAdapter(getActivity(), data);
    rightAdapter = new RightMenuAdapter(getActivity(), data);
    rightAdapter.setOnItemClickListener(new RightMenuAdapter.OnItemClickListener() {

        @Override
        public void onClick(Lesson item) {
            Log.e(TAG, "lesson:" + item.getTitle());
            SharedPreferenceManager.getInstance().putString(Constants.CURRENT_LESSON, item.getTitle());
            ((MainActivity) getActivity()).switchWords(item.getTitle());
        }
    });
    mRightMenu.setAdapter(rightAdapter);
    mRightMenu.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    mLeftMenu.setAdapter(leftAdapter);
    leftAdapter.addItemSelectedListener(this);
    initHeadView();
}
Also used : RightMenuAdapter(pri.weiqiang.myjapanese.ui.adapter.RightMenuAdapter) LeftMenuAdapter(pri.weiqiang.myjapanese.ui.adapter.LeftMenuAdapter) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) Lesson(pri.weiqiang.myjapanese.mvp.bean.Lesson)

Example 39 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project curb by irijwj.

the class InformationFragment method onCreateView.

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View info = inflater.inflate(R.layout.fragment_information, container, false);
    ButterKnife.bind(this, info);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    infoRecycler.setLayoutManager(layoutManager);
    infoRecycler.setAdapter(m_minfoAdapter);
    // 设置一些动画,但是没有显示出来
    infoRecycler.addItemDecoration(new DividerItemDecoration(checkNotNull(getActivity()), DividerItemDecoration.HORIZONTAL));
    // 设置一些颜色,但是我并不知道在哪里用的
    refreshInfoLayout.setColorSchemeColors(ContextCompat.getColor(checkNotNull(getActivity()), R.color.colorPrimary), ContextCompat.getColor(checkNotNull(getActivity()), R.color.colorAccent), ContextCompat.getColor(checkNotNull(getActivity()), R.color.colorPrimaryDark));
    // Set the scrolling view in the custom SwipeRefreshLayout.
    refreshInfoLayout.setScrollUpChild(infoRecycler);
    refreshInfoLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            presenter.loadInformation(true);
        }
    });
    setHasOptionsMenu(true);
    unbinder = ButterKnife.bind(this, info);
    return info;
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ScrollChildSwipeRefreshLayout(jxpl.scnu.curb.utils.ScrollChildSwipeRefreshLayout) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 40 with DividerItemDecoration

use of android.support.v7.widget.DividerItemDecoration in project MVCHelper by LuckyJayce.

the class ABSTestCaseFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.inflater = inflater;
    View view = inflater.inflate(R.layout.testcase, container, false);
    taskHelper = new TaskHelper<>();
    GsonBuilder builder = new GsonBuilder();
    // 格式化输出
    builder.setPrettyPrinting();
    // builder.serializeNulls();
    builder.addSerializationExclusionStrategy(new ExclusionStrategy() {

        @Override
        public boolean shouldSkipField(FieldAttributes f) {
            // true; //按注解排除
            return false;
        }

        @Override
        public boolean shouldSkipClass(Class<?> clazz) {
            // 直接排除某个类 ,return true为排除
            return clazz == Gson.class || clazz == Bitmap.class;
        }
    }).create();
    gson = builder.create();
    recyclerView = (RecyclerView) view.findViewById(R.id.testcase2_recyclerView);
    paramsRecyclerView = (LinearLayout) view.findViewById(R.id.testcase2_params_recyclerView);
    resultTextView = (TextView) view.findViewById(R.id.testcase2_result_textView);
    runButton = (Button) view.findViewById(R.id.testcase2_run_button);
    resetButton = (Button) view.findViewById(R.id.testcase2_reset_button);
    itemRunButton = view.findViewById(R.id.testcase2_run2_button);
    resultStateTextView = (TextView) view.findViewById(R.id.testcase2_resultState_textView);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(tasksAdapter = new TasksAdapter());
    // recyclerView.addItemDecoration(new DividerItemDecoration(getContext()));
    // 
    // // paramsRecyclerView.setLayoutManager(new
    // // LinearLayoutManager(getContext()));
    // // paramsRecyclerView.addItemDecoration(new
    // // DividerItemDecoration(getContext()));
    // // paramsRecyclerView.setAdapter(paramsAdapter = new ParamsAdapter());
    datas = getTestCaseDatas();
    resetButton.setOnClickListener(onClickListener);
    runButton.setOnClickListener(onClickListener);
    itemRunButton.setOnClickListener(onClickListener);
    tasksAdapter.setOnItemClickListener(onItemClickListener);
    resultTextView.setOnClickListener(onClickListener);
    updateRight();
    return view;
}
Also used : Bitmap(android.graphics.Bitmap) GsonBuilder(com.google.gson.GsonBuilder) Gson(com.google.gson.Gson) ExclusionStrategy(com.google.gson.ExclusionStrategy) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) FieldAttributes(com.google.gson.FieldAttributes)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)73 RecyclerView (android.support.v7.widget.RecyclerView)42 View (android.view.View)36 TextView (android.widget.TextView)23 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)19 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)15 ImageView (android.widget.ImageView)14 DividerItemDecoration (com.wm.remusic.widget.DividerItemDecoration)9 Drawable (android.graphics.drawable.Drawable)8 DividerItemDecoration (de.madcyph3r.example.DividerItemDecoration)8 DividerItemDecoration (io.hefuyi.listener.widget.DividerItemDecoration)7 Nullable (android.support.annotation.Nullable)6 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)6 Context (android.content.Context)5 Toolbar (android.support.v7.widget.Toolbar)5 Intent (android.content.Intent)4 ActionBar (android.support.v7.app.ActionBar)4 DividerItemDecoration (com.lzy.demo.base.DividerItemDecoration)4 DividerItemDecoration (org.michenux.drodrolib.ui.recyclerview.DividerItemDecoration)4 TargetApi (android.annotation.TargetApi)3