diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-05-31 13:02:56 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-05-31 13:02:56 +0200 |
| commit | 7179671a5f0428cbeab5a687c7866d81cf50cef0 (patch) | |
| tree | 1a8e8c373da3052e0bb409c46e44dc326f4739ba /main/src/cgeo/geocaching/WaypointPopup.java | |
| parent | 1bed89fad9e1cc8d7c5435aa17324d9122b69481 (diff) | |
| download | cgeo-7179671a5f0428cbeab5a687c7866d81cf50cef0.zip cgeo-7179671a5f0428cbeab5a687c7866d81cf50cef0.tar.gz cgeo-7179671a5f0428cbeab5a687c7866d81cf50cef0.tar.bz2 | |
#2684: Use view injection instead of view.findById()
Diffstat (limited to 'main/src/cgeo/geocaching/WaypointPopup.java')
| -rw-r--r-- | main/src/cgeo/geocaching/WaypointPopup.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/WaypointPopup.java b/main/src/cgeo/geocaching/WaypointPopup.java index ad1d981..b77fc0c 100644 --- a/main/src/cgeo/geocaching/WaypointPopup.java +++ b/main/src/cgeo/geocaching/WaypointPopup.java @@ -1,5 +1,8 @@ package cgeo.geocaching; +import butterknife.InjectView; +import butterknife.Views; + import cgeo.geocaching.apps.cache.navi.NavigationAppFactory; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Units; @@ -18,6 +21,11 @@ import android.widget.LinearLayout; import android.widget.TextView; public class WaypointPopup extends AbstractPopupActivity { + @InjectView(R.id.actionbar_title) protected TextView actionBarTitle; + @InjectView(R.id.waypoint_details_list) protected LinearLayout waypointDetailsLayout; + @InjectView(R.id.edit) protected Button buttonEdit; + @InjectView(R.id.details_list) protected LinearLayout cacheDetailsLayout; + private int waypointId = 0; private Waypoint waypoint = null; private TextView waypointDistance = null; @@ -29,6 +37,7 @@ public class WaypointPopup extends AbstractPopupActivity { @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); + Views.inject(this); // get parameters final Bundle extras = getIntent().getExtras(); if (extras != null) { @@ -55,11 +64,9 @@ public class WaypointPopup extends AbstractPopupActivity { setTitle(waypoint.getGeocode()); } - // actionbar icon - ((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(waypoint.getWaypointType().markerId), null, null, null); + actionBarTitle.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(waypoint.getWaypointType().markerId), null, null, null); - //Start filling waypoint details - details = new CacheDetailsCreator(this, (LinearLayout) findViewById(R.id.waypoint_details_list)); + details = new CacheDetailsCreator(this, waypointDetailsLayout); //Waypoint geocode details.add(R.string.cache_geocode, waypoint.getPrefix() + waypoint.getGeocode().substring(2)); @@ -67,8 +74,6 @@ public class WaypointPopup extends AbstractPopupActivity { waypointDistance = details.getValueView(); details.add(R.string.waypoint_note, waypoint.getNote()); - // Edit Button - final Button buttonEdit = (Button) findViewById(R.id.edit); buttonEdit.setOnClickListener(new OnClickListener() { @Override @@ -78,8 +83,7 @@ public class WaypointPopup extends AbstractPopupActivity { } }); - //Start filling cache details - details = new CacheDetailsCreator(this, (LinearLayout) findViewById(R.id.details_list)); + details = new CacheDetailsCreator(this, cacheDetailsLayout); details.add(R.string.cache_name, cache.getName()); addCacheDetails(); |
