示例#1
0
 @Override
 public boolean onRecyclerItemLongClick(
     RecyclerView recyclerView, View view, int position, long id, int viewHolderLayoutID) {
   switch (viewHolderLayoutID) {
     case R.layout.reportlist_item:
       PopupMenu popUpMenu = new PopupMenu(this, view);
       Menu menu = popUpMenu.getMenu();
       popUpMenu.getMenuInflater().inflate(R.menu.context_fragment_report_selection, menu);
       for (int i = 0; i < menu.size(); i++) {
         Intent intent = new Intent();
         intent.putExtra(ID, id);
         menu.getItem(i).setIntent(intent);
       }
       popUpMenu.setOnMenuItemClickListener(this);
       popUpMenu.show();
       return true;
     case R.layout.finanzuebersicht_item:
       DialogFragmentKontoEdit d =
           DialogFragmentKontoEdit.newInstance(DBDefinition.Account, id, MainAction.EDIT);
       d.show(getSupportFragmentManager(), null);
       return true;
     case R.layout.depotuebersicht_item:
       Intent intent = new Intent(this, ActivityWertpapiere.class);
       intent.putExtra(ACCOUNTID, (int) id);
       intent.putExtra(ACTION, (Parcelable) Action.ShowBuchungen);
       startActivity(intent);
       return true;
     case R.layout.hbcipassport_item:
       final long mID = id;
       AlertDialog.Builder builder = new AlertDialog.Builder(this);
       builder.setTitle(R.string.HBCIZugangDelete);
       builder.setMessage(R.string.HBCIZugangDeleteMsg);
       builder.setPositiveButton(
           getString(R.string.awlib_btnAccept),
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               try {
                 MonMaPassport passport = new MonMaPassport(mID);
                 passport.delete(DBHelper.getInstance());
               } catch (GeschaeftsObjekt.LineNotFoundException e) {
                 // TODO Execption bearbeiten
                 e.printStackTrace();
               }
             }
           });
       builder.setNegativeButton(
           getString(R.string.awlib_btnCancel),
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {}
           });
       builder.create().show();
       return true;
     default:
       return false;
   }
 }
示例#2
0
 @Override
 public void onClick(View v) {
   MonMaFragment d;
   switch (v.getId()) {
     case R.id.awlib_defaultFAB:
       int currentItem = getPager().getCurrentItem();
       switch (currentItem) {
         case 0:
           d = DialogFragmentKontoEdit.newInstance(DBDefinition.Account);
           d.show(getSupportFragmentManager(), null);
           break;
         case 1:
           d = new DialogReportDaten();
           d.show(getSupportFragmentManager(), null);
           break;
         case 3:
           if (AWUtils.hasInternetConnection(this)) {
             Intent intent = new Intent(this, ActivityHBCIActions.class);
             intent.putExtra(ACTION, (Parcelable) Action.AddHBCIZugang);
             startActivity(intent);
           } else {
             android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
             builder.setTitle(R.string.NoInternetConnection);
             builder.setMessage(R.string.NoInternetConnection);
             builder.setPositiveButton(
                 R.string.awlib_btnAccept,
                 new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int which) {}
                 });
             Dialog dlg = builder.create();
             dlg.show();
           }
           break;
       }
   }
 }