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.
The following classes can be found under context
package:
- Constructor takes the following params:
appFont
(String)- e.g., "Gotham-Black.ttf" (located in the directory
assets/fonts/
)
- e.g., "Gotham-Black.ttf" (located in the directory
loggerTag
(String)- e.g., "LOGGER"
imageFadeInDuration
(int)- e.g., 300 (in millis)
- Initializes the following libraries:
- Logger
- AndroidBaseUtils
- LeakCanary
- Iconify (required to support FontAwesome icons inside AcnTextView)
- Calligraphy
- Universal Image Loader
- ReactiveNetwork (required to observe the Internet connectivity status)
- Has multidex support
- Constructor takes the following params:
layoutRes
(int)- e.g.,
R.layout.activity_main
- e.g.,
toolbarRes
(int)- e.g.,
R.id.toolbar
- e.g.,
backButtonRes
(Integer -- nullable)- e.g.,
R.id.back_button
- e.g.,
backButtonVisible
(boolean)statusBarColor
(int)- e.g.,
R.color.statusBar
- e.g.,
- 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
The following classes can be found under view
package:
- Can do anything that FancyButton does
- Can do anything that IconTextView does
- Allows to use FontAwesome icons inside text
android:text="Hello world {fa-globe}"
- Includes the following UI components:
- ImageView
- LoadingView (default loading animation)
- GifImageView (custom loading animation)
- 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 directoryassets/
)
- Supports zoomable images
- Set the second param of above methods to
true
- Set the second param of above methods to
- Supports custom GIF image for loading animation
- Set the following attributes in XML:
app:gifSrc="loading.gif"
(located in the directoryassets/
)app:gifSize="80dp"
- Set the following attributes in XML:
- Custom XML attributes:
scaleType
(enum)fitCenter
(default)centerCrop
fitXY
gifSrc
(string)gifSize
(dimension)
- Includes the following UI components:
- SlidingTabLayout & SlidingTabStrip (customized versions of them)
- ViewPager
- 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
- 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 topair
- Each image has an aspect ratio of 1:1 if
columnType
is set totriplet
- No limit for number of rows
- Each image has an aspect ratio of 3:2 if
- 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
- Includes the following UI components:
- SliderLayout (Has no functionality -- just to be able to use PagerIndicator)
- HackyViewPager
- PagerIndicator
- Supports loading images from URL list
acn_imagepager.setImagesFromURLList(imageURLs, zoomable);
- Supports zoomable images
- Set the second param of above method to
true
- Set the second param of above method to
- Custom XML attributes:
selectedIndicatorColor
(color)unselectedIndicatorColor
(color)selectedIndicatorSize
(dimension)unselectedIndicatorSize
(dimension)indicatorBottomMargin
(dimension)
- Screenshot
- 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();
atonPause()
of your Activity or Fragment - Screenshot
- 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
- Extend it to create your own adapter
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
The following classes can be found under util
package:
- Includes static instance of Otto Event Bus
- Use this class to register/unregister Otto Event Bus
BusProvider.getInstance().register(this);
BusProvider.getInstance().unregister(this);
- Use this class to register/unregister Otto Event Bus
- Includes abstract method
onImageClicked(int position, String imageURL)
- Constructor takes the following params:
activity
(Activity)layoutRes
(int)- e.g.,
R.layout.item_text
- e.g.,
itemList
(ArrayList)
- Includes abstract method
onNewLoadRequired()
- Add
acn-android-framework
module to your project - Inside module-level
build.gradle
file (that belongs to your module), add the following line underdependencies
tag:compile project(':acn-android-framework')
- 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'
- add the following line under
See test
module for sample usage.
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.