Giter Site home page Giter Site logo

postoffice's Introduction

PostOffice

Maven Central Android Arsenal

This is a library for easily constructing Holo and Material Design Dialogs in either Light or Dark modes, and are completely styleable and customizable.

Usage

Please refer to the wiki for a more detailed explanation of how to use this library.

Call PostOffice.newMail() to start building a new dialog. This method will return a Delivery object which is an interface into the actual system Dialog that is created from the builder.

OR

Call one of the simpler quick call items;

PostOffice.newAlertMail(Context, Title, Message)
PostOffice.newAlertMail(Context, Title, Message, AlertHandler)
PostOffice.newEditTextMail(Context, Title, Hint, InputType, OnTextAcceptedListener)
PostOffice.newProgressMail(Context, Title, Suffix, Indeterminate);
PostOffice.newSimpleListMail(Context, Title, Design, Contents[], OnItemAcceptedListener<T>)

Mail Interface

Delivery interface = PostOffice.newMail(Context)
		.setTitle(<CharSequence|Integer>)
		.setMessage(<CharSequence|Integer>)
		.setAutoLinkMask(Integer)
		.setMovementMethod(MovementMethod)
		.setIcon(Integer)
		
		.setButton(Integer, <CharSequence, Integer>, DialogInterface.OnClickListener)
		.setThemeColor(int color)
		.setThemeColorFromResource(int colorResId)
		
		.showKeyboardOnDisplay(Boolean)
		.setCancelable(Boolean)
		.setCanceledOnTouchOutside(Boolean)
		.setDesign(Designs.<HOLO|MATERIAL>_<LIGHT|DARK>)
		
		.setStyle(
			new EditTextStyle.Builder(Context)
				.setText(CharSequence)
				.setHint(CharSequence)
				.setTextColor(Integer)
				.setHintColor(Integer)
				.addTextWatcher(TextWatcher)
				.setInputType(Integer)
				.setOnTextAcceptedListener(OnTextAcceptedListener)
				.build
			new ProgressStyle.Builder(Context)
				.setSuffix(String)	
				.setCloseOnFinish(Boolean)
				.setPercentageMode(Boolean)
				.setInterdeterminate(Boolean)
				.build()
			new ListStyle.Builder(Context)
				.setDividerHeight(Float)
				.setDivider(Drawable)
				.setListSelector(<Integer|Drawable>)
				.setDrawSelectorOnTop(Boolean)
				.setFooterDividersEnabled(Boolean)
				.setHeaderDividersEnabled(Boolean)
				.addHeader(View)
				.addHeader(View, Object, Boolean)
				.addFooter(View)
				.addFooter(View, Object, Boolean)
				.setOnItemClickListener(OnItemClickListener)
				.setOnItemLongClickListener(OnItemLongClickListener)
				.setOnItemAcceptedListener(OnItemAcceptedListener<T>)
				.build(BaseAdapter)
		)
		.build();
		.show(FragmentManager, String);
		.show(FragmentTransaction, String);
		.show(android.support.v4.FragmentManager, String);
		.show(android.support.v4.FragmentTransaction, String);

Delivery Interface

Here is the list of delivery interface methods

.setOnCancelListener(DialogInterface.OnCancelListener)
.setOnDismissListener(DialogInterface.OnDismissListener)
.setOnShowListener(DialogInterface.OnShowListener)
.getStyle()	

.show(FragmentManager manager, String tag)
.show(FragmentManager manager)
.show(FragmentTransaction transaction, String tag)
.show(FragmentTransaction transaction)

.show(android.support.v4.app.FragmentManager, String tag)
.show(android.support.v4.app.FragmentManager)
.show(android.support.v4.app.FragmentTransaction, String tag)
.show(android.support.v4.app.FragmentTransaction)

.getMail()
.getSupportMail()

.dismiss()
.dismissAllowStateLoss()

Example Usage

PostOffice.newAlertMail(ctx, R.string.title, R.string.message)
	      .show(getFragmentManager(), null);

or

PostOffice.newMail(ctx)
		  .setTitle("Some awesome title")
		  .setMessage("Something cool just happened, check it out.")
		  .setIcon(R.drawable.ic_launcher)
		  .setThemeColor(R.color.app_color)
		  .setDesign(Design.MATERIAL_LIGHT)
		  .show(getFragmentManager());

Screenshots

Home Home Dark Alert Holo Alert Material
EditText Material Progress Holo
List Holo List Mtrl

Going Forward

Here is a list of features I will add or look into adding in the near future. If you have any features you would like to add feel free to submit a Pull request or email me.

  • [DONE] Add the ability to click links, and set the 'Movement Method' of the alert text view.
  • Make the Material Design actions up to spec, where if the text expands the button to > 124dp, then it will switch to stacking them.
  • Add dismissive actions, i.e. alt actions such as this: Actions

Example

Implementing

Add this line to your gradle dependencies

compile 'com.r0adkll:postoffice:{latest_version}'

Author

Attribution

License

postoffice's People

Contributors

r0adkll avatar kashban 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.