android-autolayout

General

Category
Free
Tag
Dependency Injections
License
MIT License
Registered
Jan 12, 2015
Favorites
0
Link
https://github.com/dpreussler/android-autolayout
See also
Napkin
androidInject
Pocket Knife
Inject.io
Spork

Additional

Language
Java
Version
1.2.2 (Mar 25, 2015)
Created
Oct 15, 2014
Updated
Jan 18, 2016 (Retired)
Owner
Danny Preussler (dpreussler)
Activity
Badge
Generate
Download
Source code

android-autolayout

Write less code! Dont inflate views, menus, preferences manually anymore!

Gradle

compile 'de.jodamob.android:android-autolayout:1.2.2'

Usage

Why glue together your Activity and Fragments with the xml file manually? Keep the names in sync and it will be done for you.

Simple extend from one of:

AutoLayoutActivity
AutoLayoutFragment
AutoLayoutPreferenceFragment

both will do setContentView in onCreate / inflateView in onCreateView based on their name using lowercase and underscores instead of CamelCase.

So: DashboardStatisticsActivity must have a layout file dashboard_statistics_activity.xml it also searches for dashboard_statistics.xml and dashboard.xml

They also try to inflate the menu based on same names in menu folders!

If this is too dangerous for you because of changing names, you could also: Just annotate your class:

@InjectedLayout(R.id.myLayout)
public class MyActivity extends AutoLayoutActivity

or with fragment:

@InjectedLayout(R.id.myLayout)
public class MyFragment extends AutoLayoutFragment

Licensed under MIT license (c) 2014 Danny Preussler