A collection of handy classes I use in my freelance projects now easily accessible in one place.
Ideally your [Application]
class should inherit the App
class defined in Alansa.Droid
. Some other parts of the library will not work
otherwise.
If your application requires MultiDex, set MultiDex enabled
to true in the project properties and inherit the MultiDexApplication
class
defined in Alansa.Droid
.
Alansa.Droid comes with a few resources [styles, colors, layout files] to speed up your work and prevent you from doing the same thing over and over again.
Alansa.Droid has a base style Theme.Alansa.BaseTheme
that inherit from Theme.AppCompat.Light.
It also has two other styles for a Splashscreen
Theme.Alansa.AppFullscreen
and a normal app theme Theme.Alansa.AppTheme
.
<style name="AppTheme" parent="Theme.Alansa.AppTheme">
<item name="colorPrimary">YOUR_PRIMARY_COLOR_HERE</item>
<item name="colorPrimaryDark">YOUR_PRIMARY_DARK_COLOR_HERE</item>
<item name="colorAccent">YOUR_ACCENT_COLOR_HERE</item>
</style>
Create a splashscreen drawable, ideally named splashscreen.xml
. Put it in Resources\drawable
.
Here's a template of it's content:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/YOUR_BACKGROUND_COLOR_HERE"/>
<item> <bitmap android:src="@drawable/YOUR_LOGO_DRAWABLE_HERE" android:gravity="center" /> </item>
</layer-list>
<style name="SplashscreenTheme" parent="Theme.Alansa.AppFullscreen">
<item name="android:windowBackground">@drawable/YOUR_SPLASHSCREEN_DRAWABLE_NAME_HERE</item>
</style>
Alansa.Droid provides you with various colors.
- Material design primary text color BLACK
@color/primaryText
- Material design secondary text color BLACK
@color/primaryTextLight
- Material design primary text color WHITE
@color/secondaryText
- Material design secondary text color WHITE
@color/secondaryTextLight
- White
@color/white
- Window background color
@color/windowBg
Alansa.Droid comes with a Toolbar layout @layout/toolbar
already provided. Ideally you should include it in the layout file of any
Activity you want to have a toolbar. Alansa.Droid.Activities.BaseActivity
already handles inflating and setting up the toolbar for you
but you'd need to make sure that the toolbar has an id of @+id/toolbar
otherwise inflation would fail.