Search in sources :

Example 81 with ImageButton

use of android.widget.ImageButton in project AdMoney by ErnestoGonAr.

the class Detalle_Categorias method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detalle__categorias);
    bd = new BDHandlerAM(this);
    a = bd.spinneregresos();
    bandera = false;
    modificar = (TextView) findViewById(R.id.modificar);
    eliminar = (TextView) findViewById(R.id.eliminar);
    quitaricono = (TextView) findViewById(R.id.quitaricono);
    cambiaricono = (TextView) findViewById(R.id.cambiaricono);
    final ItemC item = (ItemC) getIntent().getSerializableExtra("item");
    itemaux = item;
    modificar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(Detalle_Categorias.this);
            View mView = getLayoutInflater().inflate(R.layout.categorias_selected, null);
            final EditText mtexto = (EditText) mView.findViewById(R.id.modificarb);
            final Button mguardar = (Button) mView.findViewById(R.id.modificarguardar);
            final Button mcancelar = (Button) mView.findViewById(R.id.modificarcancelar);
            mtexto.setText(itemaux.nombre);
            mtexto.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            mBuilder.setView(mView);
            AlertDialog dialog = mBuilder.create();
            dialog.show();
            mguardar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    validartexto = mtexto.getText().toString();
                    updatear(itemaux.nombre);
                    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(mtexto.getWindowToken(), 0);
                    if (bandera) {
                        bd.updateCategoriasE(primeroMayuscula(mtexto.getText().toString()), itemaux.nombre);
                    }
                    onBackPressed();
                }
            });
            mcancelar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    onBackPressed();
                }
            });
        // ///////////////////////////////////////////////////////////
        }
    });
    eliminar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(Detalle_Categorias.this).setTitle("Eliminar Categoria").setMessage("Seguro que quieres eliminar categoria").setPositiveButton("Si", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Positive");
                    if (item.nombre.equals("Prestamos")) {
                        msjprestamos();
                        onBackPressed();
                    } else {
                        bd.eliminarCE(item.nombre);
                        onBackPressed();
                    }
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Negative");
                    onBackPressed();
                }
            }).show();
        }
    });
    quitaricono.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(Detalle_Categorias.this).setTitle("Eliminar Icono").setMessage("Seguro que quieres quitar icono?").setPositiveButton("Si", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Positive");
                    bd.quitarIconoe(item.id);
                    msjiconoquitado();
                    onBackPressed();
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Negative");
                    onBackPressed();
                }
            }).show();
        }
    });
    cambiaricono.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(Detalle_Categorias.this);
            View mView = getLayoutInflater().inflate(R.layout.categoriase_elegir, null);
            ImageButton cae1 = (ImageButton) mView.findViewById(R.id.cae1);
            ImageButton cae2 = (ImageButton) mView.findViewById(R.id.cae2);
            ImageButton cae3 = (ImageButton) mView.findViewById(R.id.cae3);
            ImageButton cae4 = (ImageButton) mView.findViewById(R.id.cae4);
            ImageButton cae5 = (ImageButton) mView.findViewById(R.id.cae5);
            ImageButton cae6 = (ImageButton) mView.findViewById(R.id.cae6);
            ImageButton cae7 = (ImageButton) mView.findViewById(R.id.cae7);
            ImageButton cae8 = (ImageButton) mView.findViewById(R.id.cae8);
            ImageButton cae9 = (ImageButton) mView.findViewById(R.id.cae9);
            ImageButton cae10 = (ImageButton) mView.findViewById(R.id.cae10);
            ImageButton cae11 = (ImageButton) mView.findViewById(R.id.cae11);
            ImageButton cae12 = (ImageButton) mView.findViewById(R.id.cae12);
            ImageButton cae13 = (ImageButton) mView.findViewById(R.id.cae13);
            ImageButton cae14 = (ImageButton) mView.findViewById(R.id.cae14);
            ImageButton cae16 = (ImageButton) mView.findViewById(R.id.cae16);
            ImageButton cae17 = (ImageButton) mView.findViewById(R.id.cae17);
            ImageButton cae18 = (ImageButton) mView.findViewById(R.id.cae18);
            ImageButton cae19 = (ImageButton) mView.findViewById(R.id.cae19);
            ImageButton cae20 = (ImageButton) mView.findViewById(R.id.cae20);
            ImageButton cae21 = (ImageButton) mView.findViewById(R.id.cae21);
            ImageButton caenuevo1 = (ImageButton) mView.findViewById(R.id.caenuevo1);
            ImageButton caenuevo2 = (ImageButton) mView.findViewById(R.id.caenuevo2);
            ImageButton caenuevo3 = (ImageButton) mView.findViewById(R.id.caenuevo3);
            ImageButton caenuevo4 = (ImageButton) mView.findViewById(R.id.caenuevo4);
            ImageButton caenuevo5 = (ImageButton) mView.findViewById(R.id.caenuevo5);
            ImageButton caenuevo6 = (ImageButton) mView.findViewById(R.id.caenuevo6);
            mBuilder.setView(mView);
            AlertDialog dialog = mBuilder.create();
            dialog.show();
            cae1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 1);
                    onBackPressed();
                }
            });
            cae2.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 2);
                    onBackPressed();
                }
            });
            cae3.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 3);
                    onBackPressed();
                }
            });
            cae4.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 4);
                    onBackPressed();
                }
            });
            cae5.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 5);
                    onBackPressed();
                }
            });
            cae6.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 6);
                    onBackPressed();
                }
            });
            cae7.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 7);
                    onBackPressed();
                }
            });
            cae8.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 8);
                    onBackPressed();
                }
            });
            cae9.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 9);
                    onBackPressed();
                }
            });
            cae10.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 10);
                    onBackPressed();
                }
            });
            cae11.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 11);
                    onBackPressed();
                }
            });
            cae12.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 12);
                    onBackPressed();
                }
            });
            cae13.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 13);
                    onBackPressed();
                }
            });
            cae14.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 14);
                    onBackPressed();
                }
            });
            cae16.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 16);
                    onBackPressed();
                }
            });
            cae17.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 17);
                    onBackPressed();
                }
            });
            cae18.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 18);
                    onBackPressed();
                }
            });
            cae19.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 19);
                    onBackPressed();
                }
            });
            cae20.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 20);
                    onBackPressed();
                }
            });
            cae21.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 21);
                    onBackPressed();
                }
            });
            caenuevo1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 22);
                    onBackPressed();
                }
            });
            caenuevo2.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 23);
                    onBackPressed();
                }
            });
            caenuevo3.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 24);
                    onBackPressed();
                }
            });
            caenuevo4.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 25);
                    onBackPressed();
                }
            });
            caenuevo5.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 26);
                    onBackPressed();
                }
            });
            caenuevo6.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoe(itemaux.id, 27);
                    onBackPressed();
                }
            });
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) ItemC(layout.ItemC) InputMethodManager(android.view.inputmethod.InputMethodManager) TextView(android.widget.TextView) View(android.view.View) ImageButton(android.widget.ImageButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button)

Example 82 with ImageButton

use of android.widget.ImageButton in project AdMoney by ErnestoGonAr.

the class Detalle_CategoriasIngreso method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detalle_categoriasingreso);
    bd = new BDHandlerAM(this);
    a = bd.spinneringresos();
    bandera = false;
    modificar = (TextView) findViewById(R.id.modificari);
    eliminar = (TextView) findViewById(R.id.eliminari);
    quitaricono = (TextView) findViewById(R.id.quitariconoi);
    cambiaricono = (TextView) findViewById(R.id.cambiariconoi);
    final ItemC item = (ItemC) getIntent().getSerializableExtra("item");
    itemaux = item;
    modificar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(Detalle_CategoriasIngreso.this);
            View mView = getLayoutInflater().inflate(R.layout.categoriasi_selected, null);
            final EditText mtexto = (EditText) mView.findViewById(R.id.modificarbi);
            final Button mguardar = (Button) mView.findViewById(R.id.modificarguardari);
            final Button mcancelar = (Button) mView.findViewById(R.id.modificarcancelari);
            mtexto.setText(itemaux.nombre);
            mtexto.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            mBuilder.setView(mView);
            AlertDialog dialog = mBuilder.create();
            dialog.show();
            mguardar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    validartexto = mtexto.getText().toString();
                    updatear(itemaux.nombre);
                    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(mtexto.getWindowToken(), 0);
                    if (bandera) {
                        bd.updateCategoriasI(primeroMayuscula(mtexto.getText().toString()), itemaux.nombre);
                    }
                    onBackPressed();
                }
            });
            mcancelar.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    onBackPressed();
                }
            });
        // ///////////////////////////////////////////////////////////
        }
    });
    eliminar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(Detalle_CategoriasIngreso.this).setTitle("Eliminar Categoria").setMessage("Seguro que quieres eliminar categoria").setPositiveButton("Si", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Positive");
                    if (item.nombre.equals("Deudas")) {
                        msjprestamos();
                        onBackPressed();
                    } else {
                        bd.eliminarCI(item.nombre);
                        onBackPressed();
                    }
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Negative");
                    onBackPressed();
                }
            }).show();
        }
    });
    quitaricono.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(Detalle_CategoriasIngreso.this).setTitle("Eliminar Icono").setMessage("Seguro que quieres quitar icono?").setPositiveButton("Si", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Positive");
                    bd.quitarIconoi(item.id);
                    msjiconoquitado();
                    onBackPressed();
                }
            }).setNegativeButton("No", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    Log.d("AlertDialog", "Negative");
                    onBackPressed();
                }
            }).show();
        }
    });
    cambiaricono.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(Detalle_CategoriasIngreso.this);
            View mView = getLayoutInflater().inflate(R.layout.categoriasi_elegir, null);
            ImageButton cai1 = (ImageButton) mView.findViewById(R.id.cai1);
            ImageButton cai2 = (ImageButton) mView.findViewById(R.id.cai2);
            ImageButton cai3 = (ImageButton) mView.findViewById(R.id.cai3);
            ImageButton cai4 = (ImageButton) mView.findViewById(R.id.cai4);
            ImageButton cai5 = (ImageButton) mView.findViewById(R.id.cai5);
            ImageButton cai6 = (ImageButton) mView.findViewById(R.id.cai6);
            ImageButton cai8 = (ImageButton) mView.findViewById(R.id.cai8);
            ImageButton cai9 = (ImageButton) mView.findViewById(R.id.cai9);
            ImageButton cai10 = (ImageButton) mView.findViewById(R.id.cai10);
            ImageButton cai11 = (ImageButton) mView.findViewById(R.id.cai11);
            ImageButton cai12 = (ImageButton) mView.findViewById(R.id.cai12);
            ImageButton cai13 = (ImageButton) mView.findViewById(R.id.cai13);
            ImageButton cai14 = (ImageButton) mView.findViewById(R.id.cai14);
            ImageButton cai15 = (ImageButton) mView.findViewById(R.id.cai15);
            ImageButton cai16 = (ImageButton) mView.findViewById(R.id.cai16);
            ImageButton cai17 = (ImageButton) mView.findViewById(R.id.cai17);
            ImageButton cai18 = (ImageButton) mView.findViewById(R.id.cai18);
            ImageButton cai19 = (ImageButton) mView.findViewById(R.id.cai19);
            ImageButton cai20 = (ImageButton) mView.findViewById(R.id.cai20);
            ImageButton cai21 = (ImageButton) mView.findViewById(R.id.cai21);
            ImageButton cainuevo1 = (ImageButton) mView.findViewById(R.id.cainuevo1);
            ImageButton cainuevo2 = (ImageButton) mView.findViewById(R.id.cainuevo2);
            ImageButton cainuevo3 = (ImageButton) mView.findViewById(R.id.cainuevo3);
            ImageButton cainuevo4 = (ImageButton) mView.findViewById(R.id.cainuevo4);
            ImageButton cainuevo5 = (ImageButton) mView.findViewById(R.id.cainuevo5);
            ImageButton cainuevo6 = (ImageButton) mView.findViewById(R.id.cainuevo6);
            mBuilder.setView(mView);
            AlertDialog dialog = mBuilder.create();
            dialog.show();
            cai1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 1);
                    onBackPressed();
                }
            });
            cai2.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 2);
                    onBackPressed();
                }
            });
            cai3.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 3);
                    onBackPressed();
                }
            });
            cai4.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 4);
                    onBackPressed();
                }
            });
            cai5.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 5);
                    onBackPressed();
                }
            });
            cai6.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 6);
                    onBackPressed();
                }
            });
            cai8.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 8);
                    onBackPressed();
                }
            });
            cai9.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 9);
                    onBackPressed();
                }
            });
            cai10.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 10);
                    onBackPressed();
                }
            });
            cai11.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 11);
                    onBackPressed();
                }
            });
            cai12.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 12);
                    onBackPressed();
                }
            });
            cai13.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 13);
                    onBackPressed();
                }
            });
            cai14.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 14);
                    onBackPressed();
                }
            });
            cai15.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 15);
                    onBackPressed();
                }
            });
            cai16.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 16);
                    onBackPressed();
                }
            });
            cai17.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 17);
                    onBackPressed();
                }
            });
            cai18.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 18);
                    onBackPressed();
                }
            });
            cai19.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 19);
                    onBackPressed();
                }
            });
            cai20.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 20);
                    onBackPressed();
                }
            });
            cai21.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 21);
                    onBackPressed();
                }
            });
            cainuevo1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 22);
                    onBackPressed();
                }
            });
            cainuevo2.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 23);
                    onBackPressed();
                }
            });
            cainuevo3.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 24);
                    onBackPressed();
                }
            });
            cainuevo4.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 25);
                    onBackPressed();
                }
            });
            cainuevo5.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 26);
                    onBackPressed();
                }
            });
            cainuevo6.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bd.cambiarIconoi(itemaux.id, 27);
                    onBackPressed();
                }
            });
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) ItemC(layout.ItemC) InputMethodManager(android.view.inputmethod.InputMethodManager) TextView(android.widget.TextView) View(android.view.View) ImageButton(android.widget.ImageButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button)

Example 83 with ImageButton

use of android.widget.ImageButton in project run-wallet-android by runplay.

the class UiManager method checkPin.

public static void checkPin(final Activity activity) {
    if (!Store.isLoggedIn()) {
        if (dialog != null) {
            dialog.dismiss();
            dialog = null;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.PinDialog);
        final View dialogView = View.inflate(activity, R.layout.dialog_password, null);
        text = (TextView) dialogView.findViewById(R.id.pass_userPin);
        Button ib0 = (Button) dialogView.findViewById(R.id.button0);
        assert ib0 != null;
        ib0.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "0");
            }
        });
        Button ib1 = (Button) dialogView.findViewById(R.id.button1);
        assert ib1 != null;
        ib1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "1");
            }
        });
        Button ib2 = (Button) dialogView.findViewById(R.id.button2);
        assert ib2 != null;
        ib2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "2");
            }
        });
        Button ib3 = (Button) dialogView.findViewById(R.id.button3);
        assert ib3 != null;
        ib3.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "3");
            }
        });
        Button ib4 = (Button) dialogView.findViewById(R.id.button4);
        assert ib4 != null;
        ib4.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "4");
            }
        });
        Button ib5 = (Button) dialogView.findViewById(R.id.button5);
        assert ib5 != null;
        ib5.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "5");
            }
        });
        Button ib6 = (Button) dialogView.findViewById(R.id.button6);
        assert ib6 != null;
        ib6.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "6");
            }
        });
        Button ib7 = (Button) dialogView.findViewById(R.id.button7);
        assert ib7 != null;
        ib7.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "7");
            }
        });
        Button ib8 = (Button) dialogView.findViewById(R.id.button8);
        assert ib8 != null;
        ib8.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "8");
            }
        });
        Button ib9 = (Button) dialogView.findViewById(R.id.button9);
        assert ib9 != null;
        ib9.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                enterNum(activity, dialogView, "9");
            }
        });
        ImageButton enter = (ImageButton) dialogView.findViewById(R.id.imageButtonEnter);
        assert enter != null;
        final ImageButton cancel = (ImageButton) dialogView.findViewById(R.id.imageButtonCancel);
        assert cancel != null;
        cancel.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                text.setText("");
            }
        });
        final Button clear = (Button) dialogView.findViewById(R.id.buttonReset);
        assert clear != null;
        clear.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                ForgotPasswordDialog forgotPasswordDialog = new ForgotPasswordDialog();
                forgotPasswordDialog.show(activity.getFragmentManager(), null);
            }
        });
        builder.setView(dialogView);
        builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
                activity.finishAffinity();
            }
        });
        dialog = builder.create();
        dialog.show();
        enter.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                login(activity, true);
            }
        });
    }
}
Also used : AlertDialog(android.app.AlertDialog) ImageButton(android.widget.ImageButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button) DialogInterface(android.content.DialogInterface) ForgotPasswordDialog(run.wallet.iota.ui.dialog.ForgotPasswordDialog) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView)

Example 84 with ImageButton

use of android.widget.ImageButton in project KISS by Neamar.

the class ContactsResult method display.

@Override
public View display(Context context, int position, View v) {
    if (v == null)
        v = inflateFromId(context, R.layout.item_contact);
    // Contact name
    TextView contactName = (TextView) v.findViewById(R.id.item_contact_name);
    contactName.setText(enrichText(contactPojo.displayName, context));
    // Contact phone
    TextView contactPhone = (TextView) v.findViewById(R.id.item_contact_phone);
    contactPhone.setText(contactPojo.phone);
    // Contact photo
    ImprovedQuickContactBadge contactIcon = (ImprovedQuickContactBadge) v.findViewById(R.id.item_contact_icon);
    contactIcon.setImageDrawable(getDrawable(context));
    contactIcon.assignContactUri(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, String.valueOf(contactPojo.lookupKey)));
    contactIcon.setExtraOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            recordLaunch(v.getContext());
            queryInterface.launchOccurred(-1, ContactsResult.this);
        }
    });
    int primaryColor = Color.parseColor(UiTweaks.getPrimaryColor(context));
    // Phone action
    ImageButton phoneButton = (ImageButton) v.findViewById(R.id.item_contact_action_phone);
    phoneButton.setColorFilter(primaryColor);
    // Message action
    ImageButton messageButton = (ImageButton) v.findViewById(R.id.item_contact_action_message);
    messageButton.setColorFilter(primaryColor);
    PackageManager pm = context.getPackageManager();
    if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
        phoneButton.setVisibility(View.VISIBLE);
        messageButton.setVisibility(View.VISIBLE);
        phoneButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                launchCall(v.getContext());
            }
        });
        messageButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                launchMessaging(v.getContext());
            }
        });
        if (contactPojo.homeNumber)
            messageButton.setVisibility(View.INVISIBLE);
        else
            messageButton.setVisibility(View.VISIBLE);
    } else {
        phoneButton.setVisibility(View.INVISIBLE);
        messageButton.setVisibility(View.INVISIBLE);
    }
    return v;
}
Also used : ImprovedQuickContactBadge(fr.neamar.kiss.ui.ImprovedQuickContactBadge) ImageButton(android.widget.ImageButton) PackageManager(android.content.pm.PackageManager) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView)

Example 85 with ImageButton

use of android.widget.ImageButton in project xabber-android by redsolution.

the class ChatFragment method setUpEmoji.

private void setUpEmoji(View view) {
    final ImageButton emojiButton = (ImageButton) view.findViewById(R.id.button_emoticon);
    final View rootView = view.findViewById(R.id.root_view);
    // Give the topmost view of your activity layout hierarchy. This will be used to measure soft keyboard height
    final EmojiconsPopup popup = new EmojiconsPopup(rootView, getActivity());
    // Will automatically set size according to the soft keyboard size
    popup.setSizeForSoftKeyboard();
    // If the emoji popup is dismissed, change emojiButton to smiley icon
    popup.setOnDismissListener(new PopupWindow.OnDismissListener() {

        @Override
        public void onDismiss() {
            changeEmojiKeyboardIcon(emojiButton, R.drawable.ic_mood_black_24dp);
        }
    });
    // If the text keyboard closes, also dismiss the emoji popup
    popup.setOnSoftKeyboardOpenCloseListener(new EmojiconsPopup.OnSoftKeyboardOpenCloseListener() {

        @Override
        public void onKeyboardOpen(int keyBoardHeight) {
        }

        @Override
        public void onKeyboardClose() {
            if (popup.isShowing())
                popup.dismiss();
        }
    });
    // On emoji clicked, add it to edittext
    popup.setOnEmojiconClickedListener(new EmojiconGridView.OnEmojiconClickedListener() {

        @Override
        public void onEmojiconClicked(Emojicon emojicon) {
            if (inputView == null || emojicon == null) {
                return;
            }
            int start = inputView.getSelectionStart();
            int end = inputView.getSelectionEnd();
            if (start < 0) {
                inputView.append(emojicon.getEmoji());
            } else {
                inputView.getText().replace(Math.min(start, end), Math.max(start, end), emojicon.getEmoji(), 0, emojicon.getEmoji().length());
            }
        }
    });
    // On backspace clicked, emulate the KEYCODE_DEL key event
    popup.setOnEmojiconBackspaceClickedListener(new EmojiconsPopup.OnEmojiconBackspaceClickedListener() {

        @Override
        public void onEmojiconBackspaceClicked(View v) {
            KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
            inputView.dispatchKeyEvent(event);
        }
    });
    // To toggle between text keyboard and emoji keyboard keyboard(Popup)
    emojiButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // If popup is not showing => emoji keyboard is not visible, we need to show it
            if (!popup.isShowing()) {
                // If keyboard is visible, simply show the emoji popup
                if (popup.isKeyBoardOpen()) {
                    popup.showAtBottom();
                    changeEmojiKeyboardIcon(emojiButton, R.drawable.ic_keyboard_black_24dp);
                } else // else, open the text keyboard first and immediately after that show the emoji popup
                {
                    inputView.setFocusableInTouchMode(true);
                    inputView.requestFocus();
                    popup.showAtBottomPending();
                    final InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                    inputMethodManager.showSoftInput(inputView, InputMethodManager.SHOW_IMPLICIT);
                    changeEmojiKeyboardIcon(emojiButton, R.drawable.ic_keyboard_black_24dp);
                }
            } else // If popup is showing, simply dismiss it to show the undelying text keyboard
            {
                popup.dismiss();
            }
        }
    });
}
Also used : EmojiconGridView(github.ankushsachdeva.emojicon.EmojiconGridView) PopupWindow(android.widget.PopupWindow) InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) EmojiconGridView(github.ankushsachdeva.emojicon.EmojiconGridView) KeyEvent(android.view.KeyEvent) ImageButton(android.widget.ImageButton) Emojicon(github.ankushsachdeva.emojicon.emoji.Emojicon) EmojiconsPopup(github.ankushsachdeva.emojicon.EmojiconsPopup)

Aggregations

ImageButton (android.widget.ImageButton)158 View (android.view.View)112 TextView (android.widget.TextView)87 ImageView (android.widget.ImageView)55 Button (android.widget.Button)27 ListView (android.widget.ListView)25 AdapterView (android.widget.AdapterView)24 OnClickListener (android.view.View.OnClickListener)21 LinearLayout (android.widget.LinearLayout)21 Intent (android.content.Intent)19 RelativeLayout (android.widget.RelativeLayout)13 DialogInterface (android.content.DialogInterface)12 Bundle (android.os.Bundle)11 LayoutInflater (android.view.LayoutInflater)11 EditText (android.widget.EditText)11 ViewGroup (android.view.ViewGroup)10 ArrayList (java.util.ArrayList)10 Builder (android.app.AlertDialog.Builder)7 Drawable (android.graphics.drawable.Drawable)7 RecyclerView (android.support.v7.widget.RecyclerView)7