OoOAlertDialog

Additional

Language
Java
Version
1.0.3 (Jun 29, 2018)
Created
Jun 5, 2018
Updated
Apr 21, 2020 (Retired)
Owner
Joiner Sá (Joinersa)
Contributor
Joiner Sá (Joinersa)
1
Activity
Badge
Generate
Download
Source code

Advertisement

OoOAlertDialog

Pré-requisitos

  • É necessário que o compileSdkVersion seja maior ou igual a 26.

  • Adicione isto em seu arquivo build.gradle (Project: name_project):

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  • Adicione ao build.gradle (Module: app):
dependencies {
        implementation 'com.github.Joinersa:OoOAlertDialog:1.0.3'
}

Utilizando o OoOAlertDialog

new OoOAlertDialog.Builder(MainActivity.this)
                        .setTitle("OoOAlertDialog")
                        .setMessage("Deseja fechar este OoOAlertDialog?")
                        .setImage(R.drawable.my_imagem)
                        .setAnimation(Animation.POP)
                        .setPositiveButton("Fechar", null)
                        .setNegativeButton("Mensagem", new OnClickListener() {
                            @Override
                            public void onClick() {
                                Toast.makeText(MainActivity.this, "mensagem", Toast.LENGTH_SHORT).show();
                            }
                        })
                        .build();

Scrennshots

Funções

  • Imagem:

É possível setar uma imagem no topo da janela de diálogo com o método setImage(int id).

  • Título e mensagem:

Título e mensagem são setados respectivamente com setTitle(String title) e setMessage(String message).

  • Animações:

Existem 4 tipos de animações pré-definidas que você pode usar: ZOOM, POP, SLIDE e SIDE. A animação pode ser definida com o método: setAnimation(Animation animation).

  • Cancelável:

A janela de diálogo pode ou não ser cancelável utilizando o método setCancelable(boolean cancelable).

  • Botões (Positivo e Negativo):

Existem dois tipos de botões que podem ou não ser utilizados. Para criar os botões, com eventos de click ou não, basta utilizar os métodos, setPositiveButton(String text, OnClickListener listener) para o botão positivo e setNegativeButton(String text, OnClickListener listener) para o botão negativo.

  • Cor de background da janela:

É possível mudar a cor da janela de diálogo com o método: setBackgroundColor(int color).

  • Cor dos Botões:

Os botões positivo e negativo podem ter suas cores alteradas através dos métodos: setPositiveButtonColor(int color) e setNegativeButtonColor(int color).

  • Cor dos textos dos Botões:

Para modificação das cores dos textos dos botões positivo e negativo, utilizam-se os métodos: setPositiveButtonTextColor(int color) e setNegativeButtonTextColor(int color).

  • Cor de Título e Separador:

É possível definir uma cor para o texto do título, utilizando o método: setTitleColor(int color). A cor do separador é definida com a mesma cor do título.

  • Cor da mensagem:

Para modificar a cor do texto da mensagem, utiliza-se o método: setMessageColor(int color).

Contatos

Licença

Copyright 2018 Joiner Sá

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.