Commons


Source link: https://github.com/hrskrs/Commons

Commons

![license](https://img.shields.io/badge/license-apache 2.0-lightgrey.svg?style=flat-square)

Commons( commonslib) is a library containing some often used custom views

You can download demo from here


Usage:

Add jitpack.io in your root build.gradle :

allprojects {
  repositories {

  maven {
 url "https://jitpack.io" 
}
  
}
 
}

Note: do not add the jitpack.io repository under buildscript

Add the dependency in your app build.gradle :

dependencies {

  compile 'com.github.hrskrs:Commons:{
releaseTag
}
' 
}

Custom Views


HKTextView

A `View` extended from `AppCompatTextView`. Hence it behaves exactly same as `AppCompatTextView` itself. The only difference is that it has custom font integrated which can be used as following:

By default, you should create a folder called as fonts in assets folder, and include your custom fonts (the name of custom font will be used as a parameter):

If you want to use different name for fonts folder you can do it using setFontSrcDirectory(String) setter:

myHkTextView.setFontSrcDirectory("myFontsDir");

or for subfolders:

myHkTextView.setFontSrcDirectory("myFontsDir/mySubDir");

`XML` usage:
```xml ```
Setters/Getters:
//Custom Font directory/subdirectory setFontSrcDirectory(String);
 String getFontSrcDirectory();
  //Custom Font name  setFontName(String);
 String getFontName();

HKEditText

A `View` extended from `AppCompatEditText`. Hence it behaves exactly same as `AppCompatEditText`. The only difference is that you can set a custom font same as `HKEditText`.
`XML` usage:
```xml ```
Setters/Getters:
```java //Custom Font directory/subdirectory setFontSrcDirectory(String); String getFontSrcDirectory();

//Custom Font name setFontName(String); String getFontName();

 <br /> <h3> HKEditTextAnim </h3> A `View` extended from `TextInputLayout` implementing `HkEditText` as a child. Hence it behaves exactly same as `TextInputLayout` by accepting `HKEditText` parameters also. When you want to refer to `HKEditText` parameters dynamically, you must call `getHkEditText()` getter and set the parameters on it. Otherwise it will refer to the `TextInputLayout`:  <h5>`XML` usage:</h5> ```xml  <com.hrskrs.commonslib.views.HKEditTextAnim

 android:layout_width="match_parent"

 android:layout_height="wrap_content"

 android:hint="Custom Font (Helvetica-Normal)"

 android:textColor="@color/c_009688"

 android:textColorHint="@color/c_009688"

 app:hkCustomFont="Helvetica-Normal" />  /> 
Setters/Getters:
```java //Refering to EditText inside TextInputLayout HKEditText getHkEditText(); setHkEditText(HKEditText); ```

HKCreditCardEditText

A View extended from HKEditText. Hence it behaves exactly same as HKEditText allowing setting custom font. The difference is that it is designed to work for credit card inputs. It shows an icon based on type card you type. Right now it supports VISA, MASTERCARD and APEX. As a default it show a colorless cc icon. It has three input types which can be declared through xml as hkType and a divider which can be set through hkDivider:

  • `CC_NO` if the input will be Credit Card Number
  • `CC_DATE` if the input will be Credit Card Date
  • `CC_NO` if the input will be Credit Card CVC Number
  • The divider is set as a `char`. Hence if `hkDivider` contains a string with a length greater than 1 the first char will be used as a divider. If `hkType` is set to `CC_CVC`, the `hkDivider` will be ignored.
    `XML` usage:
    ```xml

    <com.hrskrs.commonslib.views.HKCreditCardEditText app:hkDivider="^" app:hkType="CC_DATE" android:layout_width="match_parent" android:layout_height="wrap_content" />

    <com.hrskrs.commonslib.views.HKCreditCardEditText app:hkType="CC_CVC" android:layout_width="100dp" android:layout_height="wrap_content" />

     <h5> Setters/Getters: </h5> ```java //Divider setDivider(char);
     char getDivider();
      //Credit Card Type (0 => CC_NO, 1 => CC_DATE, 2 => CC_CVC) setCcType(int);
     String getCcType();
     

    HKCreditCardEditTextAnim

    A `View` extended from `TextInputLayout` implementing `HKCreditCardEditText` as a child. Hence it behaves exactly same as `TextInputLayout` by accepting `HKCreditCardEditText` parameters also. When you want to refer to `HKCreditCardEditText` parameters dynamically, you must call `getHkCreditCardEditText()` getter and set the parameters on it. Otherwise it will refer to the `TextInputLayout`:
    `XML` usage:
    ```xml

    <com.hrskrs.commonslib.views.HKCreditCardEditTextAnim android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Expiration Date" app:hkDivider="/" app:hkType="CC_DATE" />

    <com.hrskrs.commonslib.views.HKCreditCardEditTextAnim android:layout_width="100dp" android:layout_height="wrap_content" android:hint="CVC" app:hkType="CC_CVC" />

     <h5>Setters/Getters:</h5> ```java //Refering to EditText inside TextInputLayout HKCreditCardEditText getHkCreditCardEditText();
     setHkCreditCardEditText(HKCreditCardEditText );
     

    References

    - https://github.com/Gary111/MaskedEditText

    License

    Copyright (C) 2016 Haris Krasniqi  Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License. You may obtain a copy of the License at
    
     http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

SugarLoader is a small library that adds sugar to Android Loader API.

Even when you rotate screen, tap home button, or anything, there is no risk to crash it or miss the callback, data will be loaded only once, then rendered to the restored activity/fragment, because there is Android Loader API under the hood.

A simple progress indicator (or chart widget) for Android.

Simple, Tiny, Extendable Android MVP library. No complex Base Activity, Base Fragment or Base View. Just base Presenters and View interface for you to extend from.

Extension of Android standard ImageView that lets the user scale the represented image and drag it around a pivot point defined as a fraction or a percentage.

A clean and easy to use Animated Progress View in a Square.

This project aims to implement FloatingActionButton's speed dial animation in material design guideline.

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