项目作者: hatamiarash7

项目描述 :
Android Toast For RTL Applications
高级语言: Java
项目地址: git://github.com/hatamiarash7/RTL-Toast.git
创建时间: 2018-12-26T13:43:54Z
项目社区:https://github.com/hatamiarash7/RTL-Toast

开源协议:MIT License

下载


RTL-Toast

Android Arsenal GitHub license Open Source Love png1
FOSSA Status

Android library to show Toasts in a pretty RTL way

ScreenShot

Install

Add it in your root build.gradle

  1. allprojects {
  2. repositories {
  3. ...
  4. maven {
  5. url 'https://jitpack.io'
  6. }
  7. }
  8. }

Add the dependency

  1. dependencies {
  2. implementation 'com.github.hatamiarash7:RTL-Toast:1.3'
  3. }

Usage

  1. RTLToast.error(context, message, length, withIcon);
  2. RTLToast.success(context, message, length, withIcon);
  3. RTLToast.info(context, message, length, withIcon);
  4. RTLToast.warning(context, message, length, withIcon);
  5. RTLToast.normal(context, message, length, withIcon);

You can use formatted strings

  1. RTLToast.info(context, getFormattedMessage())
  2. private CharSequence getFormattedMessage() {
  3. final String prefix = "متن ";
  4. final String highlight = "با فرمت ";
  5. final String suffix = " مخصوص";
  6. SpannableStringBuilder ssb = new SpannableStringBuilder(prefix).append(highlight).append(suffix);
  7. int prefixLen = prefix.length();
  8. ssb.setSpan(new StyleSpan(BOLD_ITALIC), prefixLen, prefixLen + highlight.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  9. return ssb;
  10. }

Or you can customize your toast with RTLToast.Config

  1. RTLToast.Config.getInstance()
  2. .setTextColor(Color.GREEN)
  3. .setToastTypeface(Typeface.createFromAsset(getAssets(), "IRANSans.ttf"))
  4. .apply();
  5. RTLToast.custom(context, message, getResources().getDrawable(R.drawable.laptop512), Color.BLACK, length, withIcon, shouldTint).show();
  6. RTLToast.Config.reset();

Support

ko-fi

Contributing

  1. Fork it!
  2. Create your feature branch : git checkout -b my-new-feature
  3. Commit your changes : git commit -am 'Add some feature'
  4. Push to the branch : git push origin my-new-feature
  5. Submit a pull request :D

Issues

Each project may have many problems. Contributing to the better development of this project by reporting them

License

FOSSA Status