Exemplo n.º 1
0
  private void showPopupChoose(
      final List<DataAdapter> listData,
      final int indexSelect,
      final EquipsView.OnClickListenerResult eventResult) {
    ListView listView = new ListView(this);
    DataArrayAdapter adapter = new DataArrayAdapter(this, R.layout.data_choose_layout, listData);
    adapter.indexChoose = indexSelect;
    final AlertView mAlert = new AlertView(this);
    mAlert.setView(listView);
    mAlert.setNegativeButton(
        R.string.alert_tag_cancel,
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            mAlert.hide();
          }
        });
    mAlert.show();
    listView.setAdapter(adapter);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            final DataAdapter item = (DataAdapter) parent.getItemAtPosition(position);

            if (eventResult != null && item != null) eventResult.onClick(item.id);
            mAlert.hide();
          }
        });
  }
Exemplo n.º 2
0
 private void showDetailEquip() {
   Equipment equipment = MyData.getInst().myEquips[idEquip];
   LinearLayout ln = new LinearLayout(this);
   ln.setLayoutParams(
       new LinearLayout.LayoutParams(
           LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
   DetailEquipView detailView = new DetailEquipView(this);
   ln.addView(detailView);
   detailView.showInforEquip(equipment);
   final AlertView alertView = AlertView.showAlert(this, ln, R.string.alert_tag_close);
   View.OnClickListener onClickGoup =
       new View.OnClickListener() {
         @Override
         public void onClick(View view) {
           alertView.hide();
         }
       };
 }