diff --git a/app/src/main/java/org/ntlab/amaryllis/client/MainActivity.java b/app/src/main/java/org/ntlab/amaryllis/client/MainActivity.java index 1437f35..ccf7ad7 100644 --- a/app/src/main/java/org/ntlab/amaryllis/client/MainActivity.java +++ b/app/src/main/java/org/ntlab/amaryllis/client/MainActivity.java @@ -53,9 +53,7 @@ private static final String TAG = MainActivity.class.getSimpleName(); LocationManager locationManager; private ArrayList listeners = new ArrayList<>(); - private HashMap categories; - ArrayList checkedList = new ArrayList<>(); - HashMap menuItemMap = new HashMap<>(); + static HashMap categories; ImageButton playbutton; ImageButton stopbutton; ImageButton skipbutton; @@ -239,39 +237,46 @@ return categories.get(cid); } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.nav_drawer_menu, menu); - - //カテゴリーの数だけitemを定義 - for(Category category : categories.values()){ - String name = category.getName(); - String cid = category.getcId(); - MenuItem newItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, name); - menuItemMap.put(newItem.getItemId(),cid); - newItem.setCheckable(true); - newItem.setChecked(true); - checkedList.add(cid); - } - return true; + public static HashMap getCategories(){ + return categories; } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - String cid = menuItemMap.get(item.getItemId()); - - item.setChecked(!item.isChecked()); - if(item.isChecked()){ - checkedList.remove(cid); - }else{ - checkedList.add(cid); - } - return super.onOptionsItemSelected(item); - } - - public ArrayList getCheckedCidList() { - return checkedList; - } +// +// @Override +// public boolean onCreateOptionsMenu(Menu menu) { +// getMenuInflater().inflate(R.menu.nav_drawer_menu, menu); +// +// //カテゴリーの数だけitemを定義 +// int id=0; +// for(Category category : categories.values()){ +// String name = category.getName(); +// String cid = category.getcId(); +// MenuItem newItem = menu.add(Menu.NONE, id, Menu.NONE, name); +// menuItemMap.put(newItem.getItemId(),cid); +// newItem.setCheckable(true); +// newItem.setChecked(true); +// checkedList.add(cid); +// id++; +// } +// return true; +// } +// +// +// @Override +// public boolean onOptionsItemSelected(MenuItem item) { +// String cid = menuItemMap.get(item.getItemId()); +// +// item.setChecked(!item.isChecked()); +// if(item.isChecked()){ +// checkedList.add(cid); +// }else{ +// checkedList.remove(cid); +// } +// return super.onOptionsItemSelected(item); +// } +// +// public ArrayList getCheckedCidList() { +// return checkedList; +// } } \ No newline at end of file