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;
}
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();
}
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();
}
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;
}
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;
}
Aggregations