MyToast


Source link: https://github.com/lopspower/MyToast

MyToast

Custom Toast on Android

Image Result

Usage

MyToast.show(this, "MyToast Sample", true);

Create

toast_layout.xml :

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/toast_border"
  android:orientation="horizontal"
  android:padding="10dp" >

<ImageView

android:id="@+id/toast_image"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:contentDescription="@string/app_name"

android:layout_marginRight="10dp" />

<TextView

android:id="@+id/toast_text"

android:layout_width="wrap_content"

android:layout_height="fill_parent"

android:gravity="center"

android:textColor="@color/White" />  </LinearLayout>

MyToast.java :

package com.mikhaellopez.mytoast;  import android.content.Context; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast;  public class MyToast {

  public static void show(Context context, String text, boolean isLong) {

LayoutInflater inflater = LayoutInflater.from(context);

View layout = inflater.inflate(R.layout.toast_layout, null);

 ImageView image = (ImageView) layout.findViewById(R.id.toast_image);

image.setImageResource(R.drawable.ic_launcher);

 TextView textV = (TextView) layout.findViewById(R.id.toast_text);

textV.setText(text);

 Toast toast = new Toast(context);

toast.setGravity(Gravity.CENTER, 0, 0);

toast.setDuration((isLong) ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);

toast.setView(layout);

toast.show();

  
}
 
}

License

MyToast by Lopez Mikhael is licensed under a Apache License 2.0.

Resources

geo

Java utility methods for geohashing.

A very, very compact library that enables you to create on-demand singletons within your application and easily store them to disk. Utilizing a dead-simple API, this library makes creating singletons and persisting data much more fun!

This app is built during the free time of the developer for fun. It provides with a tool to test some Intent behavior while building and testing other apps or just for fun playing with the framework. ;) This app would not work and feel the same way if it weren't for some great Android open-source projects that were used during the development.

Material Design Example is a sample application for the new design concept made by Google, Material Design. Besides the design, we have the new APIs introduced in Android SDK Lollipop:

  • Custom theme colors
  • Circular reveal
  • Activity transitions
  • Toolbar
  • Recycler View
  • Card View

Common re-usable module repository for the convenience of Android application development.

HorizontalPicker is an open source android library that enables users to select single item by scrolling or tapping left and right to move between an array of items.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes