After some thought, I decided that ButterKnife was a better fit. Here are the steps I used for swapping out the libraries:
Step 1: Undo the RoboGuice Integration.
I just reversed the steps from the blog entry to return to a clean slate.
Step 2: Bring in ButterKnife
Update the MyNotes gradle.build file with the following:
release {
// Library specific proguard files
...
proguardFiles 'proguard-butterknife.pro'
}
....
dependencies {
....
compile 'com.jakewharton:butterknife:6.1.0'
}
Add proguard-butterknife.pro to the project with the following content:
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
Incorporate it into the MainActivity:
/**
* UI element to display the note data.
*/
@InjectView(R.id.activity_main_notes_recycler_view)
RecyclerView mCardsRecyclerView;
/**
* UI element to allow a user to create a new note.
*/
@InjectView(R.id.activity_main_add_view)
View mAddView;
/**
* The adapter to manage the display of cards in {@link #mCardsRecyclerView}.
*/
CardAdapter mCardAdapter;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
Commits:
These changes can be found in this commit: https://github.com/fsk-software/mynotes/commit/dd7302156d91fd0a376ce0a254351fac83026db8
No comments :
Post a Comment