use of androidx.recyclerview.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());
SharedPreferenceManager.getInstance().putInt(Constants.CURRENT_LESSON_ID, item.getId());
((MainActivity) getActivity()).switchWords(item.getTitle(), false);
}
});
mRightMenu.setAdapter(rightAdapter);
mRightMenu.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
mLeftMenu.setAdapter(leftAdapter);
leftAdapter.addItemSelectedListener(this);
// 设置初始滚动位置
Log.e(TAG, "CURRENT_LESSON_ID:" + SharedPreferenceManager.getInstance().getInt(Constants.CURRENT_LESSON_ID, Constants.DEFAULT_LESSON_ID));
mRightMenu.scrollToPosition(SharedPreferenceManager.getInstance().getInt(Constants.CURRENT_LESSON_ID, Constants.DEFAULT_LESSON_ID));
initHeadView();
}
use of androidx.recyclerview.widget.DividerItemDecoration in project LiYuJapanese 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());
SharedPreferenceManager.getInstance().putInt(Constants.CURRENT_LESSON_ID, item.getId());
((MainActivity) getActivity()).switchWords(item.getTitle(), false);
}
});
mRightMenu.setAdapter(rightAdapter);
mRightMenu.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
mLeftMenu.setAdapter(leftAdapter);
leftAdapter.addItemSelectedListener(this);
// 设置初始滚动位置
Log.e(TAG, "CURRENT_LESSON_ID:" + SharedPreferenceManager.getInstance().getInt(Constants.CURRENT_LESSON_ID, Constants.DEFAULT_LESSON_ID));
mRightMenu.scrollToPosition(SharedPreferenceManager.getInstance().getInt(Constants.CURRENT_LESSON_ID, Constants.DEFAULT_LESSON_ID));
initHeadView();
}
use of androidx.recyclerview.widget.DividerItemDecoration in project EhViewer by seven332.
the class FavoritesScene method onCreateDrawerView.
@Override
public View onCreateDrawerView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.drawer_list_rv, container, false);
final Context context = getContext2();
Toolbar toolbar = (Toolbar) ViewUtils.$$(view, R.id.toolbar);
AssertUtils.assertNotNull(context);
toolbar.setTitle(R.string.collections);
toolbar.inflateMenu(R.menu.drawer_favorites);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
int id = item.getItemId();
switch(id) {
case R.id.action_default_favorites_slot:
String[] items = new String[12];
items[0] = getString(R.string.let_me_select);
items[1] = getString(R.string.local_favorites);
String[] favCat = Settings.getFavCat();
System.arraycopy(favCat, 0, items, 2, 10);
new AlertDialog.Builder(context).setTitle(R.string.default_favorites_collection).setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Settings.putDefaultFavSlot(which - 2);
}
}).show();
return true;
}
return false;
}
});
EasyRecyclerView recyclerView = (EasyRecyclerView) view.findViewById(R.id.recycler_view_drawer);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
mDrawerAdapter = new FavDrawerAdapter(inflater);
recyclerView.setAdapter(mDrawerAdapter);
recyclerView.setOnItemClickListener(this);
return view;
}
use of androidx.recyclerview.widget.DividerItemDecoration in project ToyShark by LipiLee.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.packet_list);
final RecyclerView recyclerView = findViewById(R.id.packet_list_recycler_view);
recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
final PacketListAdapter adapter = new PacketListAdapter(PacketManager.INSTANCE.getList());
PacketManager.INSTANCE.setAdapter(adapter);
recyclerView.setAdapter(adapter);
checkRuntimePermission();
}
use of androidx.recyclerview.widget.DividerItemDecoration in project collect by opendatakit.
the class ChoicesRecyclerView method enableDivider.
private void enableDivider() {
DividerItemDecoration divider = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.inset_divider_64dp);
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
DrawableCompat.setTint(DrawableCompat.wrap(drawable), new ThemeUtils(getContext()).getColorOnSurface());
}
divider.setDrawable(drawable);
addItemDecoration(divider);
}
Aggregations