Skip to content

dpreussler/android-autolayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Maven Central

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

About

get rid of your setContentView(), inflateView..

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages