Code Monkey home page Code Monkey logo

androiddialogs's Introduction

AndroidDialogs

Helper to implements UI Dialogs and Toast on Android.

Installation

haxelib install androiddialogs

Set up haxelib in .XML

<haxelib name="androiddialogs" />

Simple Example Use Extension (Toast):

import extension.androiddialogs.AndroidDialogs;

class SimpleExampleToast
{
    function AnyFuntion():Void
    {
        AndroidDialogs.ShowToast("Hello Haxe Programmer!", AndroidDialogs.LENGTH_LONG);//or LENGTH_SHORT duration
    }
}

Simple Example Use Extension (Dialog Confirmation):

import extension.androiddialogs.AndroidDialogs;

class SimpleExampleDialogConfirmation
{
    function AnyFuntion():Void
    {
        /*
            param: Title dialog.
            param: Message dialog.
            param: Caption confirm button dialog.
            param: Caption cancel button dialog.
        */
        AndroidDialogs.ShowAlertDialog("Title", "Message", "Confirm", "Cancel");
    }

    function OtherFunctionGetResult():Void
    {
        //get string user selection
        trace(AndroidDialogs.objHaxe.answerDialog);
    }
}

Simple Example Use Extension (Dialog List Options with Radio Button):

import extension.androiddialogs.AndroidDialogs;

class SimpleExampleDialogRadioButton
{
    function AnyFuntion():Void
    {
        var names_players:Array<String> = new Array<String>();
        names_players.push("Pity Martinez");
        names_players.push("Jonathan Maidana");
        names_players.push("Enzo Perez");
        names_players.push("Ignacio Scoco");
        names_players.push("Leonardo Ponzio");
        /*
            param: Title dialog.
            param: Array String values
        */
        AndroidDialogs.ShowAlertSelectOption("Title", names_players);
    }

    function OtherFunctionGetResult():Void
    {
        //get string user selection
        trace(AndroidDialogs.objHaxe.answerOptionSelected);
    }
}

Simple Example Use Extension (Dialog List Options with Multiple Selection):

import extension.androiddialogs.AndroidDialogs;

class SimpleExampleDialogMultipleSelection
{
    function AnyFuntion():Void
    {
        var names_players:Array<String> = new Array<String>();
        names_players.push("Pity Martinez");
        names_players.push("Jonathan Maidana");
        names_players.push("Enzo Perez");
        names_players.push("Ignacio Scoco");
        names_players.push("Leonardo Ponzio");
        /*
            param: Title dialog.
            param: Array String values
        */
        AndroidDialogs.ShowAlertMultipleSelectOption("Title", names_players);
    }

    function OtherFunctionGetResult():Void
    {
        //get value boolean user selection
        for (valueBoolean in AndroidDialogs.objHaxe.answersOptionsMultipleSelected)
        {
            trace("FLAG: " + valueBoolean);
        }
    }
}

License

The MIT License (MIT) - LICENSE.md

Copyright © 2018 MilköGames (http://www.milkogames.xyz)

Author: Nicolás Capel

androiddialogs's People

Contributors

nicolastuka avatar

Stargazers

fnfpwp avatar Stefan avatar Mo Zurasuta avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.