@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.bluemagicset_context, menu); BlueMagicSetView ms; boolean set; ms = (BlueMagicSetView) findViewById(R.id.Magics); set = getFFXICharacter().isBlueMagicSet(ms.getItemId(mLongClickingItemPosition)); MenuItem item; item = menu.findItem(R.id.Remove); if (item != null) item.setEnabled(set); item = menu.findItem(R.id.Set); if (item != null) item.setEnabled(!set); }
@Override public void onStart() { super.onStart(); FFXICharacter charInfo = getFFXICharacter(); // setup controls { BlueMagicSetView ms; ms = (BlueMagicSetView) findViewById(R.id.Magics); if (ms != null) { ms.bindFFXICharacter(charInfo); ms.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {} }); ms.setOnItemLongClickListener( new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { mLongClickingItemPosition = arg2; openContextMenu(arg0); return true; } }); registerForContextMenu(ms); } } { BlueMagicSelectionStatusView bmss; bmss = (BlueMagicSelectionStatusView) findViewById(R.id.StatusView); if (bmss != null) { bmss.bindFFXICharacter(charInfo); } } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bluemagicseteditactivity); }