Michelangelo


Source link: https://github.com/RomainPiel/Michelangelo

Michelangelo

Layout inflation library for Android which uses annotation processing to write the code you don't want to write and simplify your compound views.

How to use

An example of use:

@InflateLayout(R.layout.custom_view) public class MyCustomView extends FrameLayout {

public MyCustomView(Context context) {

super(context);

  
}

@AfterInflate
  public void updateTextView() {

((TextView) findViewById(R.id.my_text_view)).setText("hey!");

  
}
 
}

R.layout.custom_view:

<merge xmlns:android="http://schemas.android.com/apk/res/android">

<TextView

 android:id="@+id/my_text_view"

 android:layout_width="match_parent"

 android:layout_height="wrap_content"/>  </merge>

Inflating that View is pretty straightforward:

MyCustomView view = Michelangelo.build(this, MyCustomView.class);

Post inflate methods

Use the annotation @AfterInflate on your compound view's methods you want to run straight after the layout is inflated with Michelangelo.

Michelangelo and ButterKnife

Michelangelo plays very well with Jake Wharton's library ButterKnife. Just add the annotation @InjectViews to your ViewGroup and Michelangelo will do the rest.

Example using ButterKnife:

@InflateLayout(R.layout.item_painting) @InjectViews public class PaintingItemView extends LinearLayout {

@InjectView(R.id.image) ImageView image;
  @InjectView(R.id.title) TextView title;

public PaintingItemView(Context context) {

super(context);

setOrientation(HORIZONTAL);

  
}

public void bind(Painting painting) {

image.setImageResource(painting.getDrawableResId());

title.setText(painting.getTitle());

  
}
 
}

Order of events

When you call Michelangelo.build():

  1. The view gets inflated
  2. If specified, the injector is applied ( ButterKnife.inject(view))
  3. If exist, methods annotated with @AfterInflate are run.

Sample

See the sample for a common use of this library with ListView adapters.

License

Copyright 2014 Romain Piel  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

An android color picker with changeable color drawable for easy styling.

This custom listview basically shows a holder view when it's adapter is empty. For example, you may fetch list datas from network and refresh your adapter with coming data. If the data is empty, your listview shows a huge blank space. With this custom listview, you can show a holder view instead of blank space and your design looks prettier.

Android M was added to check permissions, but permissions checking is so dirty.

This project allows to check permissions easily.

The library distributes canvas animation over set of devices.

A huge set of utils for Android development.

Unofficial Streamable API Wrapper for Android.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes