Skip to content

Overview of Android SDK

Here you can read an overview over how to the android-sdk is structured and used.

OverbliqTools

This is the core of the sdk, here you can find content providers, Overbliq-services models, request handlers, different services and utils.

Content providers

A content-provider is a simple class to get json responses from Overbliq-services parsed to objects to use in the application.
All content-providers must be run in a background thread by using an AsyncTask or equivalent, but it is recommended to use a GenericLoader which is a Service in the OverbliqTools library (the genericloader has error handling and uses a thread pool for requests, it also reports to a asynctask manager for better overview).
Example för GenericLoader:

GenericLoader<Schedule, String> ( "Get schedule task", {
    // background thread 
    scheduleProvider.getSchedule( scheduleId )
}, {
    // main thread
    // do something with your schedule
},
onFail = { 
    msg, _ -> Log.e(TAG, msg) 
})
.execute()

Services

Here is a list of services in the OverbliqTools library

  • GenericLoader: Use to du background tasks such as downloading content from Overbliq-Services. Example found above
  • OverbliqFactory: Contains references to all providers in the library and works like a global dependency tool.
    OverbliqFactory example: OverbliqFactory.getInstance(application).beaconProvier().all

Example: How it fit together

To use the providers with services is explained in the following example.

// Get provider from overbliqfactory. You can also use getInstanceOrNull() to get an optional<OverbliqFactory>   
// if you dont have access to an application at the moment, but the first call to the overbliqfacotyr must be with  
// an application, otherwise it cannot create the instance.
val scheduleProvider = OverbliqFactory.getInstance(application).scheduleProdvider

// Create a new GenericLoader and execute it
GenericLoader<Schedule, String> ( "Get schedule task", {
    // Here in background thread use the provider to return i schedule in this case  
    scheduleProvider.getSchedule( scheduleId )
}, { schedule -> 
    // do something with your schedule 
    // For example if you also have access to the android-widgets library (android-widgets depends on OverbliqTools, so only needed to include one or the other)
    // You can instance a new ScheduleView to include somewere
    viewGroup.add( 
         FetchFilteredScheduleView(context, schedule = schedule)
    )
},
onFail = { msg, _ ->
    // Handle error message that may occer 
    Log.e(TAG, msg) 
})
.execute()

Android widgets

This package can be used as a complete application see Getting started
Or you can use parts of it. Following sections contains all the parts of the android-widgets package.

Overbliq-Activities

ActionTargetHandlingActivity

An activity that reacts to actiontargets sent by the application.
Can be extended.

OverbliqMainActivity

This is the MainActivity of a generic overbliq application, it extends ActionTargetHandlingActivity.

BeaconActivity

This is an extension to OverbliqMainActivity which provides beaconsupport, it sends actiontargets depending on nearby beacons.

GenericSplash

The generic splash screen used in OverbliqMainActivity to load all necessary start content for the activity to work this activity can be replaced in the OverbliqApplication class.

GenericAdSplash

This is an other splash screen with similar properties as GenericSplash, but it can show an ad for a defined amount of time. To use this activity as instead of GenericSplash in OverbliqMainActivity use following line in OverbliqApplication.

    var splashClass: KClass<out AppCompatActivity> = GenericAdSplash::class

Overbliq-Fragments

Use newInstance static method on the fragments to make instance.

TitledFragment

An abstract class which contains an actiontarget and a title, this fragment is the base fragment for all other fragments that comes from a actiontarget intent.

ViewFragment

Extends TitledFragment.
This Fragment is a helper if you want to wrap i view inside a fragment. Use if you need an Overbliq-View and can only use fragments in your current context, example viewpager.

ComponentFragment

Extends TitledFragment.
This is the most important fragment in the overbliq-android-sdk. It takes a componentPage and uses formats from

    var typeMap : HashMap<Component.Type, HashMap<String, AbstractFormat>>

in OverbliqApplication to make a componentPage view.
To add own formats add AbstractFormat implementation to namespace se.overbliq.lib.componentFormats.
Soon you should be able to add own ComponentModule as well (Not implemented yet). Example on ComponentModule is FavouriteModule.

MultiLinkFragmentMenu

Extends TitledFragment.
Displays a list of ViewHolders in a ViewGroup (Not recycling).
Use for menu where all links is visible and dont need recycling. Example is bottom menu in Overbliq default application.

WebViewFragment

Extends TitledFragment.
A fragment to display web content from an ActionTarget where target is an url.

MapFragment

Extends TitledFragment.
This fragment is to display all insights in a google map view.
This is a complex fragment which is easiest managed with MapManager.

CarouselFragment

Extends TitledFragment. Use to display a Carousel image view with actionTargetHolders.

pej.ProfileFragment

Extends TitledFragment.
Display your pej orders, only used if pej integration is enabled in appConfig.xml

    <bool name="pejEnabled">true</bool>
    <string name="pejUrl" translatable="false">sandbox-api.pej.se/v1.1</string>
    <string name="pejSchemeForManifest" translatable="false">example</string>

Overbliq-Views

Overbliq-Views is generic views for all model objects in Overbliq-services. All views recourse files can be overwritten in each application-project if you have all the necessary ids for the views. All views should be able to use in xml layout file if provided with correct data

FetchFormView

View for form.

FetchFilteredScheduleView

View for a schedule or a list of events. The view displays all provided events and a filter function to only display events with a specific tag.

HorizontalScheduleView

View for a schedule or a list of events. The view is to display all provided events in a horizontal recycler view with two events on each row.

LinkView

Generic view for a ActionTargetHolder. Sends ActionTarget when clicked on.

MosaicView

A view to display a list of ActionTargetHolders in a mosaic like pattern (Can be overwritten).

MultiLinkView

A view to display a list of ActionTargetHolders in a RecyclerView.

PicasaImageView

An imageView that can download image from an url.

SecretInfoPage

A debug page for developers and tester to verify app version.

SoundView

A simple sound controller view, that can play sounds from an url.

OpenBackApp

Is a extension to Android-widgets that lets you extend the provided openbackApplication to get push notifications to work in your application.
Just extend the openbackApplication and overwrite following with the openback id.

    <string name="openBackId"> </string>