Coder Social home page Coder Social logo

acn-android-framework's Introduction

ACN Android Framework Android Arsenal

Build Status API MIT license

ACN Android Framework is being developed to reduce application development effort and time by encapsulating the initialization and configuration of many widely-used third-party libraries inside its custom Application and Activity classes.

It also provides custom view classes with extra features added to default views of Android and other third-party views shared on GitHub. See below for more details.

Table of Contents

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

1. Context classes

The following classes can be found under context package:

AcnApplication (abstract class, extends Application)

  • Constructor takes the following params:
    • appFont (String)
      • e.g., "Gotham-Black.ttf" (located in the directory assets/fonts/)
    • loggerTag (String)
      • e.g., "LOGGER"
    • imageFadeInDuration (int)
      • e.g., 300 (in millis)
  • Initializes the following libraries:
  • Has multidex support

AcnActivity (abstract class, extends AppCompatActivity)

  • Constructor takes the following params:
    • layoutRes (int)
      • e.g., R.layout.activity_main
    • toolbarRes (int)
      • e.g., R.id.toolbar
    • backButtonRes (Integer -- nullable)
      • e.g., R.id.back_button
    • backButtonVisible (boolean)
    • statusBarColor (int)
      • e.g., R.color.statusBar
  • Initializes the following libraries:
  • Registers/unregisters Otto Event Bus at onResume()/onPause()
  • Includes abstract method onInternetStatusChanged(ConnectivityStatus status)
    • Override it to catch the Internet connection status changes
    • While overriding, add @Subscribe before the method

2. View classes

The following classes can be found under view package:

AcnButton (extends FancyButton)

AcnTextView (extends IconTextView)

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:gifSrc="loading.gif" (located in the directory assets/)
      • app:gifSize="80dp"
  • Custom XML attributes:
    • scaleType (enum)
      • fitCenter (default)
      • centerCrop
      • fitXY
    • gifSrc (string)
    • gifSize (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 FontAwesome icons inside tab titles
  • Custom XML attributes:
    • indicatorColor (color)
    • dividerColor (color)
    • selectedTitleColor (color)
    • unselectedTitleColor (color)
    • tabBackgroundColor (color)
    • tabTitleSize (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() { ... });
  • Custom XML attributes:
    • spacing (dimension)
    • columnType (enum)
      • pair (default)
      • triplet
  • 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
  • Custom XML attributes:
    • selectedIndicatorColor (color)
    • unselectedIndicatorColor (color)
    • selectedIndicatorSize (dimension)
    • unselectedIndicatorSize (dimension)
    • indicatorBottomMargin (dimension)
  • Screenshot

AcnVideoView (extends JCVideoPlayer)

  • Can do anything that Jiecao Video Player does
  • Supports loading video & thumbnail image from URL and configuring video title
    • acn_videoview.setVideo(videoURL, thumbnailURL, videoTitle, showTitle);
  • You need to call AcnVideoView.releaseAllVideos(); at onPause() of your Activity or Fragment
  • Screenshot

AcnInfiniteListView (extends 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
      • 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
  • Add new item to list as follows:
    • acn_infinitelistview.addNewItem(item);
  • Screenshot

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);

ImageClickHandler (abstract class)

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

InfiniteListAdapter (abstract class, extends ArrayAdapter)

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

4. How to use this framework

  1. Add acn-android-framework module to your project
  2. Inside module-level build.gradle file (that belongs to your module), add the following line under dependencies tag:
    • compile project(':acn-android-framework')
  3. Inside project-level build.gradle file...
    • add the following line under allprojects/repositories tag:
      • maven { url "https://jitpack.io" }
    • add the following line under buildscript/dependencies tag:
      • classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

See test module for sample usage.

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.

acn-android-framework's People

Contributors

ugurcany avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.