Coder Social home page Coder Social logo

arbazmateen / commons Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 284 KB

Common android components, helper functions, adaptors, dialogs, logs and extentions functions that is required for almost every application at startup.

License: GNU General Public License v3.0

Kotlin 99.40% Java 0.60%
recycleradaptor recyclerviewadaptor logutils dialogs adaptor extentionfunction kotlin helperfunctions baseadaptor preferences

commons's Introduction

Commons

Common android components, helper functions, adaptors, dialogs, logs and extentions functions that is required for almost every application at startup.

Modules

  1. Dialogs
  2. Adaptors
  3. Extensions
  4. Preference
  5. Input Validator

Dialogs

  1. Information Dialog
  2. Warning Dialog
  3. Error Dialog
  4. Delete Dialog
  5. Wait Dialog
  6. How to use
  7. Calling From Java

Information Dialog

	infoDialog(
                this,   			// context
                "Information",  		// title
                "Some informational message",   // message
                true    			// cancelable on back press or touch anywhere on the screen
            ).show()

or

	infoDialog(
                this,   			// context
                "Information",  		// title
                "Some informational message",   // message
                true    			// cancelable on back press or touch anywhere on the screen
            ).setPositiveButton("OK") { dialog, _ ->
                // Ok button action
                dialog.dismiss()
            }.setNegativeButton("Close") { dialog, _ ->
                // close button action
                dialog.dismiss()
            }.show()

Warning Dialog

	warningDialog(
                this,   			// context
                "Warning",  			// title
                "Some warning message",   	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).show()

or

	warningDialog(
                this,   			// context
                "Warning",  			// title
                "Some warning message",   	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).setPositiveButton("OK") { dialog, _ ->
                // Ok button action
                dialog.dismiss()
            }.setNegativeButton("Close") { dialog, _ ->
                // close button action
                dialog.dismiss()
            }.show()

Error Dialog

	errorDialog(
                this,   			// context
                "Error",  			// title
                "Some error message",   	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).show()

or

	errorDialog(
                this,   			// context
                "Error",  			// title
                "Some error message",   	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).setPositiveButton("OK") { dialog, _ ->
                // Ok button action
                dialog.dismiss()
            }.setNegativeButton("Close") { dialog, _ ->
                // close button action
                dialog.dismiss()
            }.show()

Delete Dialog

	confirmDelete(
                this,   			// context
                "Confirm Delete",  		// title
                "Some confirmation message",   	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).setPositiveButton("Delete") { dialog, _ ->
                // Ok button action
                dialog.dismiss()
            }.setNegativeButton("Close") { dialog, _ ->
                // close button action
                dialog.dismiss()
            }.show()
            .getButton(AlertDialog.BUTTON_POSITIVE)
                .setTextColor(ContextCompat.getColor(this, android.R.color.holo_red_light))

Wait Dialog

	waitDialog(
                this,   			// context
                "Loading, Please wait...",  	// message
                true    			// cancelable on back press or touch anywhere on the screen
            ).show()

How to use dialogs

add this line to project build.gradle file

	allprojects {
		repositories {
			maven { url 'https://jitpack.io' }
		}
	}

add this line to app build.gradle file

	dependencies {
	        implementation 'com.github.ArbazMateen.Commons:dialogs:0.1.2'
	}

Calling from Java

	Dialog.infoDialog(
                this,
                "Some informational message"
        ).setPositiveButton("", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // positive button action
                dialog.dismiss();
            }
        }).setNegativeButton("Close", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                // negative button action
                dialog.dismiss();
            }
        }).show();

commons's People

Contributors

arbazmateen avatar

Watchers

 avatar

Forkers

arbaz-softagics

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.