kandi background
Explore Kits

TextDrawable | weight library provides images with letter/text | Android library

 by   amulyakhare Java Version: Current License: MIT

 by   amulyakhare Java Version: Current License: MIT

kandi X-RAY | TextDrawable Summary

TextDrawable is a Java library typically used in Mobile, Android applications. TextDrawable has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.
###TextDrawable This light-weight library provides images with letter/text like the Gmail app. It extends the Drawable class thus can be used with existing/custom/network ImageView classes. Also included is a fluent interface for creating drawables and a customizable ColorGenerator.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • TextDrawable has a medium active ecosystem.
  • It has 3118 star(s) with 611 fork(s). There are 120 watchers for this library.
  • It had no major release in the last 6 months.
  • There are 40 open issues and 17 have been closed. On average issues are closed in 36 days. There are 18 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of TextDrawable is current.
TextDrawable Support
Best in #Android
Average in #Android
TextDrawable Support
Best in #Android
Average in #Android

quality kandi Quality

  • TextDrawable has 0 bugs and 0 code smells.
TextDrawable Quality
Best in #Android
Average in #Android
TextDrawable Quality
Best in #Android
Average in #Android

securitySecurity

  • TextDrawable has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • TextDrawable code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
TextDrawable Security
Best in #Android
Average in #Android
TextDrawable Security
Best in #Android
Average in #Android

license License

  • TextDrawable is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
TextDrawable License
Best in #Android
Average in #Android
TextDrawable License
Best in #Android
Average in #Android

buildReuse

  • TextDrawable releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • It has 887 lines of code, 85 functions and 20 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
TextDrawable Reuse
Best in #Android
Average in #Android
TextDrawable Reuse
Best in #Android
Average in #Android
Top functions reviewed by kandi - BETA

kandi has reviewed TextDrawable and discovered the below as its top functions. This is intended to give you an instant insight into TextDrawable implemented functionality, and help decide if they suit your requirements.

  • Creates a DataItem for a DataItem
    • Get a rectangular rectangle
    • Gets a rectangle with the multi letter color
    • Get a rectangle with custom size
  • Called when an item is clicked
    • Gets the navigation info
  • Draws this TextView
    • Draw the border
  • Creates the list view
    • Initializes the drawer builder
      • Return the count of the data source
        • Returns the data item at the specified position
          • Get the dark shade of a given color
            • Sets the alpha value
              • Set the color filter

                Get all kandi verified functions for this library.

                Get all kandi verified functions for this library.

                TextDrawable Key Features

                Mix-match with other drawables. Use it in conjunction with LayerDrawable, InsetDrawable, AnimationDrawable, TransitionDrawable etc.

                Compatible with other views (not just ImageView). Use it as background drawable, compound drawable for TextView, Button etc.

                Use multiple letters or unicode characters to create interesting tiles.

                TextDrawable Examples and Code Snippets

                Community Discussions

                Trending Discussions on TextDrawable
                • Xamarin Android TabbedPage show FontAwesome icon on tab
                • Convert From Android.Graphics.Drawables To Byte[] in Xamarin Android C#
                • I fetch contact profile image from contact book but photo is stretched always
                Trending Discussions on TextDrawable

                QUESTION

                Xamarin Android TabbedPage show FontAwesome icon on tab

                Asked 2020-Oct-17 at 00:57

                I want to show icons and text on my Android TabbedPage tabs in my Xamarin application, and I want them to be FontAwesome glyphs rather than png files.

                My TabbedPage is defined in code, and I originally set the IconImageSource for the child pages in their constructors. In iOS, that's all I seem to need to do for png files to show up, but in Android that didn't work (though I think it should have, no idea why it didn't) so I seem to need a custom renderer even for the pngs. This renderer works for pngs if I add an "IconName" field to each of my ContentPage classes and set its value to the name of the png file (without the .png extension):

                using System;
                using System.Collections.Generic;
                using System.ComponentModel;
                using System.IO;
                using System.Linq;
                using System.Text;
                
                using Android.App;
                using Android.Content;
                using Android.Graphics;
                using Android.Graphics.Drawables;
                using Android.OS;
                using Android.Runtime;
                using Android.Support.Design.Internal;
                using Android.Support.Design.Widget;
                using Android.Support.V4.Content;
                using Android.Views;
                using Android.Widget;
                using Origami.MobileForms.Droid.Renderers;
                using Origami.MobileForms.Pages;
                using Xamarin.Forms;
                using Xamarin.Forms.Platform.Android;
                using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
                
                [assembly: ExportRenderer(typeof(FormTabbedPage), typeof(ExtendedTabbedPageRenderer))]
                namespace Origami.MobileForms.Droid.Renderers
                {
                    public class ExtendedTabbedPageRenderer : TabbedRenderer
                    {
                        public ExtendedTabbedPageRenderer(Context context) : base(context) { }
                
                        protected override void DispatchDraw(global::Android.Graphics.Canvas canvas)
                        {
                            base.DispatchDraw(canvas);
                
                            SetTabIcons();
                        }
                
                        private void SetTabIcons()
                        {
                
                            var element = this.Element;
                            if (null == element)
                            {
                                return;
                            }
                
                            Activity activity = this.Context as Activity;
                            if ((null != activity && null != activity.ActionBar && activity.ActionBar.TabCount > 0))
                            {
                                for (int i = 0; i < element.Children.Count; i += 1)
                                {
                                    Android.App.ActionBar.Tab tab = activity.ActionBar.GetTabAt(i);
                                    var page = element.Children[i];
                                    if ((null != tab) && (null != page) && (null != page.IconImageSource))
                                    {
                                        var customImagePage = page as ICustomImagePage;
                                        if(customImagePage != null)
                                        {
                                            var resourceId = Resources.GetIdentifier(customImagePage.IconName.ToLower(), "drawable", Context.PackageName);
                                            tab.SetIcon(resourceId);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                

                I'm trying to figure out how to use FontAwesome icons instead of .png files here. I did figure out how to use a FontAwesome icon as the IconImageSource in my ContentPage:

                this.IconImageSource = new FontImageSource { FontFamily = "fa-solid", Size = 30,  Glyph= "\uf15c", Color = Color.Red }; 
                

                with this attribute added in my shared project over the namespace of the App class:

                [assembly: ExportFont("fa-solid-900.ttf", Alias = "fa-solid")]
                

                However, the SetIcon method that I'm using in the TabbedRenderer override only accepts a ResourceID or a Drawable as a parameter, and I'm not sure how to generate either one of those from a FontAwesome icon. I tried using the TextDrawable NuGet package by eddydn as follows in my custom renderer, which compiles and runs, but no icon shows up:

                private void SetTabIcons()
                {
                
                    var element = this.Element;
                    if (null == element)
                    {
                        return;
                    }
                
                    Activity activity = this.Context as Activity;
                    if ((null != activity && null != activity.ActionBar && activity.ActionBar.TabCount > 0))
                    {
                        for (int i = 0; i < element.Children.Count; i += 1)
                        {
                            var page = element.Children[i];
                            if ((null != tab) && (null != page) && (null != page.IconImageSource))
                            {
                                var customImagePage = page as ICustomImagePage;
                                if(customImagePage != null)
                                {
                                    Typeface font = Typeface.Create("fa-solid", TypefaceStyle.Normal);
                                    TextDrawable icon = new TextDrawable.Builder().BeginConfig().TextColor(Android.Graphics.Color.Red).UseFont(font)
                                        .FontSize(30).EndConfig()
                                        .BuildRect("\uf15c", Android.Graphics.Color.Red);
                                    tab.SetIcon(icon);
                                }
                            }
                        }
                    }
                }
                

                I have also tried another way to get the drawable object for the SetIcon call, using the IconDrawable class defined here (and modifying the line in IconDrawable that sets the Typeface to use Create or CreateFromAsset based on how I imported FontAwesome) like this:

                var drawable = new IconDrawable(this.Context, "\uf15c";", "fa-solid").Color(Xamarin.Forms.Color.Red.ToAndroid()).SizeDp(30);
                

                Thank you in advance for any assistance you may be able to offer!

                ANSWER

                Answered 2020-Oct-17 at 00:46

                I was almost there with my last attempt above - the issue was that I was trying to set up the IconDrawable as:

                Typeface.Create(fontFacePath, TypefaceStyle.Normal);
                

                I hoped that would create the Typeface using the files I had included in my shared project and added to the code of that project via attributes, but maybe including them that newer way doesn't make the font accessible in the Droid project... Anyway, when I instead used the old way of adding FontAwesome to a project - add FontAwesome under the Assets folder in the Droid project (either an .otf or a .ttf) and call

                Typeface.CreateFromAsset(context.Assets, $"{fontFacePath}.otf") 
                

                (or .ttf) to get the typeface - that worked fine.

                Source https://stackoverflow.com/questions/64392366

                Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                Vulnerabilities

                No vulnerabilities reported

                Install TextDrawable

                You can download it from GitHub.
                You can use TextDrawable like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the TextDrawable component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

                Support

                For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                Find more information at:

                Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                over 650 million Knowledge Items
                Find more libraries
                Reuse Solution Kits and Libraries Curated by Popular Use Cases
                Explore Kits

                Save this library and start creating your kit

                Clone
                • https://github.com/amulyakhare/TextDrawable.git

                • gh repo clone amulyakhare/TextDrawable

                • git@github.com:amulyakhare/TextDrawable.git

                Share this Page

                share link

                See Similar Libraries in

                Reuse Pre-built Kits with TextDrawable
                Consider Popular Android Libraries
                Try Top Libraries by amulyakhare
                Compare Android Libraries with Highest Support
                Compare Android Libraries with Highest Quality
                Compare Android Libraries with Highest Security
                Compare Android Libraries with Permissive License
                Compare Android Libraries with Highest Reuse
                Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                over 650 million Knowledge Items
                Find more libraries
                Reuse Solution Kits and Libraries Curated by Popular Use Cases
                Explore Kits

                Save this library and start creating your kit