use of com.androidstudy.medmanager.data.model.MenuView in project Andela-Med-Manager by jumaallan.
the class MainDashboardAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(MenuOptionsViewHolder holder, int position) {
MenuView menuItem = menuList.get(position);
holder.textView.setText(menuItem.getName());
holder.imageView.setImageResource(menuItem.getImage());
}
use of com.androidstudy.medmanager.data.model.MenuView in project Andela-Med-Manager by jumaallan.
the class MainActivity method getMenuOptions.
// Mock Data
private List<MenuView> getMenuOptions() {
List<MenuView> listViewItems = new ArrayList<>();
listViewItems.add(new MenuView(1, "Add Medicine", R.drawable.ic_sample));
listViewItems.add(new MenuView(2, "Profile", R.drawable.ic_sample));
listViewItems.add(new MenuView(3, "Reminders", R.drawable.ic_sample));
listViewItems.add(new MenuView(4, "Monthly Intake", R.drawable.ic_sample));
return listViewItems;
}
use of com.androidstudy.medmanager.data.model.MenuView in project Andela-Med-Manager by jumaallan.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
User user = new User(Long.valueOf("1"), "Data Binding", "User");
binding.setUser(user);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ButterKnife.bind(this);
profileDialog = ProfileDialog.newInstance(((dialog, which) -> logout()));
calendar = Calendar.getInstance();
simpleDateFormat = new SimpleDateFormat("EEEE, MMM d, yyyy");
String currentDate = simpleDateFormat.format(calendar.getTime());
date.setText(currentDate);
menuViewList = getMenuOptions();
recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
ItemOffsetDecoration itemDecoration = new ItemOffsetDecoration(this, R.dimen.item_offset);
recyclerView.addItemDecoration(itemDecoration);
MainDashboardAdapter mainDashboardAdapter = new MainDashboardAdapter(this, menuViewList, (v, position) -> {
MenuView role = menuViewList.get(position);
String menuName = role.getName();
switch(menuName) {
case "Add Medicine":
Intent addMedicine = new Intent(getApplicationContext(), AddMedicineActivity.class);
startActivity(addMedicine);
break;
case "Profile":
break;
case "Reminders":
break;
case "Monthly Intake":
break;
default:
Toast.makeText(MainActivity.this, "Sorry, It's Under development", Toast.LENGTH_SHORT).show();
break;
}
});
recyclerView.setAdapter(mainDashboardAdapter);
DailyMedicineStatisticsAdapter dailyMedicineStatisticsAdapter = new DailyMedicineStatisticsAdapter(this, new ArrayList<>());
recyclerViewDailyMedicineStatistics.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
// add pager behavior
PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(recyclerViewDailyMedicineStatistics);
// pager indicator
recyclerViewDailyMedicineStatistics.addItemDecoration(new CirclePagerIndicatorDecoration());
recyclerViewDailyMedicineStatistics.setAdapter(dailyMedicineStatisticsAdapter);
// MedicineViewModel medicineViewModel = ViewModelProviders.of(this).get(MedicineViewModel.class);
// medicineViewModel.getMedicineList().observe(MainActivity.this, dailyMedicineStatisticsAdapter::addItems);
}
Aggregations