Advertisement
Sketchware

Apagar listview

Jun 28th, 2023
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.88 KB | None | 0 0
  1. if (anotodo.size() > 0) {
  2.     AlertDialog.Builder builder = new AlertDialog.Builder(AnoTodoActivity.this);
  3.     builder.setTitle("AVISO!!!!");
  4.  
  5.     // Cria um TextView personalizado para exibir o texto piscante
  6.     TextView messageView = new TextView(AnoTodoActivity.this);
  7.     messageView.setText("DESEJA APAGAR OS DADOS ??🫡");
  8.     messageView.setTextSize(16);
  9.     messageView.setTextColor(Color.BLACK);
  10.     messageView.setPadding(20, 20, 20, 20);
  11.  
  12.     // Cria uma animação para piscar o texto
  13.     AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
  14.     alphaAnimation.setDuration(500);
  15.     alphaAnimation.setRepeatCount(Animation.INFINITE);
  16.     alphaAnimation.setRepeatMode(Animation.REVERSE);
  17.  
  18.     // Define a animação no TextView
  19.     messageView.startAnimation(alphaAnimation);
  20.  
  21.     builder.setView(messageView);
  22.  
  23.     builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
  24.         @Override
  25.         public void onClick(DialogInterface dialog, int which) {
  26.             SketchwareUtil.showMessage(AnoTodoActivity.this, "CLICA E AGUARDE 3 SEGUNDOS PARA APAGAR!\n");
  27.             n = 0;
  28.             for (int _repeat50 = 0; _repeat50 < (int)(anotodo.size()); _repeat50++) {
  29.                 fire_ano.child(anotodo.get((int)n).get("keyy").toString()).removeValue();
  30.                 n++;
  31.             }
  32.             SketchwareUtil.showMessage(AnoTodoActivity.this, "Você apagou tudo!");
  33.         }
  34.     });
  35.  
  36.     builder.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
  37.         @Override
  38.         public void onClick(DialogInterface dialog, int which) {
  39.             ((BaseAdapter)listview2_ano.getAdapter()).notifyDataSetChanged();
  40.         }
  41.     });
  42.  
  43.     AlertDialog alertDialog = builder.create();
  44.     alertDialog.show();
  45. } else {
  46.     SketchwareUtil.showMessage(AnoTodoActivity.this, "Não há nada para apagar!");
  47.     return;
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement