ACN Android Framework


Source link: https://github.com/ugurcany/ACN-Android-Framework

ACN Android Framework

ACN Android Framework is being developed to reduce application development effort and time providing custom...

  1. Application and Activity classes that encapsulate general configuration of application and initialization of many widely-used third-party libraries.
  2. View classes with sophisticated, yet easy-to-use features, powered by default views of Android and other third-party views shared on GitHub.

See test module for sample usage of the framework.

Table of Contents

  1. Context classes
  2. View classes
  3. Util classes
  4. How to use
  5. License

1. Context classes

The following classes can be found under context package:

AcnApplication (abstract class, extends Application)

  • Application class that extends AcnApplication needs to provide required params inside constructor method:
super.build()

.cacheSize(1024 * 1024 * 5) // in bytes -- default: 1 kB

.appFont("MyFont.ttf")

// located in the directory "assets/fonts/"

.imageCacheInMemory(true)
// default: false

.imageCacheOnDisk(true)
  // default: false

.imageFadeInDuration(300);
  // in ms -- default: 0 ms

AcnActivity (abstract class, extends AppCompatActivity)

  • Activity class that extends AcnActivity needs to provide required params inside constructor method:
super.build(this)

.contentRes(R.layout.my_activity)
// required

.toolbarRes(R.id.toolbar)

  // required

.backButtonRes(R.id.back_button)
 // nullable

.backButtonVisible(true)

// default: false

.statusBarColor(R.color.statusBar)  // nullable

.usesButterKnife(true)

  // default: false -- required to use Butter Knife(https://github.com/JakeWharton/butterknife) features

.usesOttoEventBus(true)

 // default: false -- registers/unregisters Otto Event Bus(https://github.com/square/otto) at onResume()/onPause()

.internetStatusListener(new InternetStatusListener() {

 @Subscribe

 public void onInternetStatusChanged(ConnectivityStatus status) {

  /*DO SOMETHING HERE*/

 
}

}
);

2. View classes

The following classes can be found under view package:

AcnImageView (extends FrameLayout)

  • Includes the following UI components:
  • Supports loading image from URL, drawable, and assets
    • acn_imageview.setImageFromURL("http://goo.gl/T59s3M", zoomable);
    • acn_imageview.setImageFromDrawable(R.drawable.image, zoomable);
    • acn_imageview.setImageFromAssets("image.jpg", zoomable); (located in the directory assets/)
  • Supports zoomable images
    • Set the second param of above methods to true
  • Supports custom GIF image for loading animation
    • Set the following attributes in XML:
      • app:loadingGifSrc="loading.gif" (located in the directory assets/)
      • app:loadingGifSize="80dp"
  • Custom XML attributes:
    • scaleType (enum)
      • fitCenter (default)
      • centerCrop
      • fitXY
    • loadingGifSrc (string)
    • loadingGifSize (dimension)

AcnViewPager (extends LinearLayout)

  • Includes the following UI components:
  • Set fragments and tab titles with one line of code:
    • acn_viewpager.setContent(fragments, tabTitles);
  • Supports using Font Awesome icons inside tab titles
  • Custom XML attributes:
    • indicatorColor (color)
    • dividerColor (color)
    • selectedTitleColor (color)
    • unselectedTitleColor (color)
    • tabBackgroundColor (color)
    • tabTitleSize (dimension)
  • Screenshot

AcnImagePager (extends RelativeLayout)

  • Includes the following UI components:
  • Supports loading images from URL list
    • acn_imagepager.setImagesFromURLList(imageURLs, zoomable);
  • Supports zoomable images
    • Set the second param of above method to true
  • Supports custom GIF image for loading animation
    • Set the following attributes in XML:
      • app:loadingGifSrc="loading.gif" (located in the directory assets/)
      • app:loadingGifSize="80dp"
  • Custom XML attributes:
    • selectedIndicatorColor (color)
    • unselectedIndicatorColor (color)
    • selectedIndicatorSize (dimension)
    • unselectedIndicatorSize (dimension)
    • indicatorBottomMargin (dimension)
    • loadingGifSrc (string)
    • loadingGifSize (dimension)
  • Screenshot

AcnImageGallery (extends LinearLayout)

  • Includes two or three AcnImageView components at each row, depending on columnType attribute
    • Each image has an aspect ratio of 3:2 if columnType is set to pair
    • Each image has an aspect ratio of 1:1 if columnType is set to triplet
    • No limit for number of rows
  • Supports loading images from URL list
    • acn_imagegallery.setImagesFromURLList(imageURLs);
  • Set ImageClickHandler to handle image clicks
    • acn_imagegallery.setImageClickHandler(new ImageClickHandler() { ... } );
  • Supports custom GIF image for loading animation
    • Set the following attributes in XML:
      • app:loadingGifSrc="loading.gif" (located in the directory assets/)
      • app:loadingGifSize="80dp"
  • Custom XML attributes:
    • spacing (dimension)
    • columnType (enum)
      • pair (default)
      • triplet
    • loadingGifSrc (string)
    • loadingGifSize (dimension)
  • Screenshot

AcnInfiniteListView (extends FrameLayout)

  • Includes the following UI components:
    • SwipeRefreshLayout
    • ListView
  • Initialize it as follows:
    • acn_infinitelistview.init(adapter, maxNumOfItems, loadingView);
      • adapter ( InfiniteListAdapter)
        • Extend it to create your own adapter
          • Override its onNewLoadRequired() method to load new items when required
          • Override its onRefresh() method to set what to do on swipe-to-refresh
      • maxNumOfItems (int)
        • To make listview prevent loading more when item count reaches this number
      • loadingView (View)
        • Footer view to be displayed while loading new items
  • Includes the following methods:
    • acn_infinitelistview.addNewItem(item); -> adds new item to list
    • acn_infinitelistview.clearList(); -> clears entire list (and triggers onNewLoadRequired())
    • acn_infinitelistview.startLoading(); -> call this before item loading starts
    • acn_infinitelistview.stopLoading(); -> call this after item loading ends
  • Screenshot

AcnImageSlideshow (extends AcnImageView)

  • Supports loading images from URL list
    • acn_imageslideshow.setImagesAndStartAnimation(imageURLs, delayInMs);
      • delayInMs -> duration of time for each image displayed
  • You need to call acn_imageslideshow.stopAnimation(); at onDestroy() of your Activity or Fragment

AcnButton (extends FancyButton)

AcnTextView (extends IconTextView)

3. Util classes

The following classes can be found under util package:

BusProvider

  • Includes static instance of Otto Event Bus
  • Use this class to register/unregister Otto Event Bus
    • BusProvider.getInstance().register(this);
    • BusProvider.getInstance().unregister(this);

InternetStatusListener (abstract class)

  • Includes abstract method onInternetStatusChanged(ConnectivityStatus status)

ImageClickHandler (abstract class)

  • Includes abstract method onImageClicked(int position, String imageURL)

InfiniteListAdapter (abstract class, extends ArrayAdapter)

  • Constructor takes the following params:
    • activity (Activity)
    • itemLayoutRes (int)
      • e.g., R.layout.item_text
    • itemList (ArrayList)
  • Includes abstract methods onNewLoadRequired() and onRefresh()

4. How to use

Step 1. Add the JitPack repository in your root build.gradle at the end of repositories:

allprojects {

  repositories {

...

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

  
}
 
}
 

Step 2. Add the dependency:

dependencies {

  compile 'com.github.ugurcany:acn-android-framework:X.Y.Z' 
}
 

Step 3. To be able to use all features of the framework, add the corresponding dependencies for the following libraries:

5. License

The MIT License (MIT)  Copyright (c) 2016 Ugurcan Yildirim  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

Resources

A simple library for implementing scratchable Views.

This is a small basic sample for use the basic sentences CRUD with realm library in android.

A library makes your application's auto update more elegant!

Android PopupWindow that can be easily located relative to anchor View.

An Android library that enables snappy smooth scrolling in RecyclerView.

Android and Java library for mocking and testing networking layers with built-in support for Retrofit.

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