diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-09-29 10:27:39 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-09-29 11:33:57 +0200 |
commit | 85ae6e32a7ad26bd380cc42014ae3b72f71f1c84 (patch) | |
tree | 5d384c27b1987a54bcc7a34f8cf9c818acd6d8d1 /main/src | |
parent | fcbb3f6ee70b08281d13b2e01d914cd80da63bc1 (diff) | |
download | cgeo-85ae6e32a7ad26bd380cc42014ae3b72f71f1c84.zip cgeo-85ae6e32a7ad26bd380cc42014ae3b72f71f1c84.tar.gz cgeo-85ae6e32a7ad26bd380cc42014ae3b72f71f1c84.tar.bz2 |
Do not assign getView() view parameter
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/cgeo/geocaching/cgCacheListAdapter.java | 54 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgGPXListAdapter.java | 20 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgMapfileListAdapter.java | 20 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeopoint.java | 16 |
4 files changed, 59 insertions, 51 deletions
diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java index d361822..a307f93 100644 --- a/main/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java @@ -354,7 +354,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { } @Override - public View getView(int position, View rowView, ViewGroup parent) { + public View getView(final int position, final View rowView, final ViewGroup parent) { if (inflater == null) { inflater = ((Activity) getContext()).getLayoutInflater(); } @@ -366,29 +366,31 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { cgCache cache = getItem(position); - if (rowView == null) { - rowView = (View) inflater.inflate(R.layout.cache, null); + View v = rowView; + + if (v == null) { + v = (View) inflater.inflate(R.layout.cache, null); holder = new cgCacheView(); - holder.oneCache = (RelativeLayout) rowView.findViewById(R.id.one_cache); - holder.checkbox = (CheckBox) rowView.findViewById(R.id.checkbox); - holder.oneInfo = (RelativeLayout) rowView.findViewById(R.id.one_info); - holder.oneCheckbox = (RelativeLayout) rowView.findViewById(R.id.one_checkbox); - holder.logStatusMark = (ImageView) rowView.findViewById(R.id.log_status_mark); - holder.oneCache = (RelativeLayout) rowView.findViewById(R.id.one_cache); - holder.text = (TextView) rowView.findViewById(R.id.text); - holder.directionLayout = (RelativeLayout) rowView.findViewById(R.id.direction_layout); - holder.distance = (cgDistanceView) rowView.findViewById(R.id.distance); - holder.direction = (cgCompassMini) rowView.findViewById(R.id.direction); - holder.dirImgLayout = (RelativeLayout) rowView.findViewById(R.id.dirimg_layout); - holder.dirImg = (ImageView) rowView.findViewById(R.id.dirimg); - holder.inventory = (RelativeLayout) rowView.findViewById(R.id.inventory); - holder.favourite = (TextView) rowView.findViewById(R.id.favourite); - holder.info = (TextView) rowView.findViewById(R.id.info); - - rowView.setTag(holder); + holder.oneCache = (RelativeLayout) v.findViewById(R.id.one_cache); + holder.checkbox = (CheckBox) v.findViewById(R.id.checkbox); + holder.oneInfo = (RelativeLayout) v.findViewById(R.id.one_info); + holder.oneCheckbox = (RelativeLayout) v.findViewById(R.id.one_checkbox); + holder.logStatusMark = (ImageView) v.findViewById(R.id.log_status_mark); + holder.oneCache = (RelativeLayout) v.findViewById(R.id.one_cache); + holder.text = (TextView) v.findViewById(R.id.text); + holder.directionLayout = (RelativeLayout) v.findViewById(R.id.direction_layout); + holder.distance = (cgDistanceView) v.findViewById(R.id.distance); + holder.direction = (cgCompassMini) v.findViewById(R.id.direction); + holder.dirImgLayout = (RelativeLayout) v.findViewById(R.id.dirimg_layout); + holder.dirImg = (ImageView) v.findViewById(R.id.dirimg); + holder.inventory = (RelativeLayout) v.findViewById(R.id.inventory); + holder.favourite = (TextView) v.findViewById(R.id.favourite); + holder.info = (TextView) v.findViewById(R.id.info); + + v.setTag(holder); } else { - holder = (cgCacheView) rowView.getTag(); + holder = (cgCacheView) v.getTag(); } if (cache.own) { @@ -410,10 +412,10 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { } final touchListener touchLst = new touchListener(cache.geocode, cache.name, cache); - rowView.setOnClickListener(touchLst); - rowView.setOnLongClickListener(touchLst); - rowView.setOnTouchListener(touchLst); - rowView.setLongClickable(true); + v.setOnClickListener(touchLst); + v.setOnLongClickListener(touchLst); + v.setOnTouchListener(touchLst); + v.setLongClickable(true); if (selectMode) { if (cache.statusCheckedView) { @@ -628,7 +630,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { } holder.info.setText(cacheInfo.toString()); - return rowView; + return v; } @Override diff --git a/main/src/cgeo/geocaching/cgGPXListAdapter.java b/main/src/cgeo/geocaching/cgGPXListAdapter.java index 3153c98..5db046c 100644 --- a/main/src/cgeo/geocaching/cgGPXListAdapter.java +++ b/main/src/cgeo/geocaching/cgGPXListAdapter.java @@ -23,7 +23,7 @@ public class cgGPXListAdapter extends ArrayAdapter<File> { } @Override - public View getView(int position, View rowView, ViewGroup parent) { + public View getView(final int position, final View rowView, final ViewGroup parent) { if (inflater == null) inflater = ((Activity) getContext()).getLayoutInflater(); @@ -34,25 +34,27 @@ public class cgGPXListAdapter extends ArrayAdapter<File> { File file = getItem(position); - if (rowView == null) { - rowView = (View) inflater.inflate(R.layout.gpx_item, null); + View v = rowView; + + if (v == null) { + v = (View) inflater.inflate(R.layout.gpx_item, null); holder = new cgGPXView(); - holder.filepath = (TextView) rowView.findViewById(R.id.filepath); - holder.filename = (TextView) rowView.findViewById(R.id.filename); + holder.filepath = (TextView) v.findViewById(R.id.filepath); + holder.filename = (TextView) v.findViewById(R.id.filename); - rowView.setTag(holder); + v.setTag(holder); } else { - holder = (cgGPXView) rowView.getTag(); + holder = (cgGPXView) v.getTag(); } final touchListener touchLst = new touchListener(file); - rowView.setOnClickListener(touchLst); + v.setOnClickListener(touchLst); holder.filepath.setText(file.getParent()); holder.filename.setText(file.getName()); - return rowView; + return v; } @Override diff --git a/main/src/cgeo/geocaching/cgMapfileListAdapter.java b/main/src/cgeo/geocaching/cgMapfileListAdapter.java index c0f8f5b..89cb1f5 100644 --- a/main/src/cgeo/geocaching/cgMapfileListAdapter.java +++ b/main/src/cgeo/geocaching/cgMapfileListAdapter.java @@ -25,7 +25,7 @@ public class cgMapfileListAdapter extends ArrayAdapter<File> { } @Override - public View getView(int position, View rowView, ViewGroup parent) { + public View getView(final int position, final View rowView, final ViewGroup parent) { if (inflater == null) inflater = ((Activity) getContext()).getLayoutInflater(); @@ -36,16 +36,18 @@ public class cgMapfileListAdapter extends ArrayAdapter<File> { File file = getItem(position); - if (rowView == null) { - rowView = (View) inflater.inflate(R.layout.mapfile_item, null); + View v = rowView; + + if (v == null) { + v = (View) inflater.inflate(R.layout.mapfile_item, null); holder = new MapfileView(); - holder.filepath = (TextView) rowView.findViewById(R.id.mapfilepath); - holder.filename = (TextView) rowView.findViewById(R.id.mapfilename); + holder.filepath = (TextView) v.findViewById(R.id.mapfilepath); + holder.filename = (TextView) v.findViewById(R.id.mapfilename); - rowView.setTag(holder); + v.setTag(holder); } else { - holder = (MapfileView) rowView.getTag(); + holder = (MapfileView) v.getTag(); } File current = new File(parentView.getCurrentMapfile()); @@ -57,12 +59,12 @@ public class cgMapfileListAdapter extends ArrayAdapter<File> { } final touchListener touchLst = new touchListener(file); - rowView.setOnClickListener(touchLst); + v.setOnClickListener(touchLst); holder.filepath.setText(file.getParent()); holder.filename.setText(file.getName()); - return rowView; + return v; } @Override diff --git a/main/src/cgeo/geocaching/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java index 26e3bce..140619c 100644 --- a/main/src/cgeo/geocaching/cgeopoint.java +++ b/main/src/cgeo/geocaching/cgeopoint.java @@ -45,19 +45,21 @@ public class cgeopoint extends AbstractActivity { } @Override - public View getView(int position, View convertView, ViewGroup parent) { + public View getView(final int position, final View convertView, final ViewGroup parent) { cgDestination loc = getItem(position); - if (convertView == null) { - convertView = getInflater().inflate(R.layout.simple_way_point, + View v = convertView; + + if (v == null) { + v = getInflater().inflate(R.layout.simple_way_point, null); } - TextView longitude = (TextView) convertView + TextView longitude = (TextView) v .findViewById(R.id.simple_way_point_longitude); - TextView latitude = (TextView) convertView + TextView latitude = (TextView) v .findViewById(R.id.simple_way_point_latitude); - TextView date = (TextView) convertView.findViewById(R.id.date); + TextView date = (TextView) v.findViewById(R.id.date); String lonString = cgBase.formatLongitude(loc.getCoords().getLongitude(), true); String latString = cgBase.formatLatitude(loc.getCoords().getLatitude(), true); @@ -66,7 +68,7 @@ public class cgeopoint extends AbstractActivity { latitude.setText(latString); date.setText(cgBase.formatShortDateTime(getContext(), loc.getDate())); - return convertView; + return v; } private LayoutInflater getInflater() { |