From 9f39b088e3d15622e06c9c075ffd52bb128afc9d Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sun, 29 Jun 2014 16:14:25 +0200 Subject: fix lint warning: layout inflation root --- main/src/cgeo/geocaching/AboutActivity.java | 25 +++---- main/src/cgeo/geocaching/CacheDetailActivity.java | 48 ++++++------- main/src/cgeo/geocaching/CacheListActivity.java | 8 +-- main/src/cgeo/geocaching/LogCacheActivity.java | 2 +- .../cgeo/geocaching/NavigateAnyPointActivity.java | 82 +++++++++++----------- main/src/cgeo/geocaching/StaticMapsActivity.java | 8 +-- main/src/cgeo/geocaching/TrackableActivity.java | 7 +- main/src/cgeo/geocaching/UsefulAppsActivity.java | 18 ++--- .../activity/AbstractViewPagerActivity.java | 50 ++++++------- .../geocaching/connector/gc/RecaptchaHandler.java | 11 +-- .../ui/AbstractCachingPageViewCreator.java | 10 +-- .../src/cgeo/geocaching/ui/AddressListAdapter.java | 4 +- .../cgeo/geocaching/ui/CacheDetailsCreator.java | 18 ++--- main/src/cgeo/geocaching/ui/CacheListAdapter.java | 30 ++++---- .../geocaching/ui/FileSelectionListAdapter.java | 14 ++-- main/src/cgeo/geocaching/ui/GPXListAdapter.java | 12 ++-- main/src/cgeo/geocaching/ui/ImagesList.java | 13 ++-- .../cgeo/geocaching/ui/logs/LogsViewCreator.java | 19 ++--- 18 files changed, 195 insertions(+), 184 deletions(-) (limited to 'main/src') diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java index 5bf0f06..8c4de40 100644 --- a/main/src/cgeo/geocaching/AboutActivity.java +++ b/main/src/cgeo/geocaching/AboutActivity.java @@ -19,6 +19,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; +import android.view.ViewGroup; import android.widget.ScrollView; import android.widget.TextView; @@ -37,8 +38,8 @@ public class AboutActivity extends AbstractViewPagerActivity @InjectView(R.id.license_text) protected TextView licenseText; @Override - public ScrollView getDispatchedView() { - final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_license_page, null); + public ScrollView getDispatchedView(final ViewGroup parentView) { + final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_license_page, parentView, false); ButterKnife.inject(this, view); setClickListener(licenseLink, "http://www.apache.org/licenses/LICENSE-2.0.html"); licenseText.setText(getRawResourceString(R.raw.license)); @@ -51,8 +52,8 @@ public class AboutActivity extends AbstractViewPagerActivity @InjectView(R.id.contributors) protected TextView contributors; @Override - public ScrollView getDispatchedView() { - final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_contributors_page, null); + public ScrollView getDispatchedView(final ViewGroup parentView) { + final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_contributors_page, parentView, false); ButterKnife.inject(this, view); contributors.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); return view; @@ -66,8 +67,8 @@ public class AboutActivity extends AbstractViewPagerActivity @InjectView(R.id.changelog_release) protected TextView changeLogRelease; @Override - public ScrollView getDispatchedView() { - final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_changes_page, null); + public ScrollView getDispatchedView(final ViewGroup parentView) { + final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_changes_page, parentView, false); ButterKnife.inject(this, view); changeLogRelease.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); final String changeLogMasterString = getString(R.string.changelog_master); @@ -91,8 +92,8 @@ public class AboutActivity extends AbstractViewPagerActivity @InjectView(R.id.faq) protected TextView faq; @Override - public ScrollView getDispatchedView() { - final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_help_page, null); + public ScrollView getDispatchedView(final ViewGroup parentView) { + final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_help_page, parentView, false); ButterKnife.inject(this, view); setClickListener(support, "mailto:support@cgeo.org"); setClickListener(website, "http://www.cgeo.org/"); @@ -117,8 +118,8 @@ public class AboutActivity extends AbstractViewPagerActivity @InjectView(R.id.donate) protected TextView donateButton; @Override - public ScrollView getDispatchedView() { - final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_version_page, null); + public ScrollView getDispatchedView(final ViewGroup parentView) { + final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_version_page, parentView, false); ButterKnife.inject(this, view); version.setText(Version.getVersionName(AboutActivity.this)); setClickListener(donateButton, "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AQBS7UP76CXW2"); @@ -145,7 +146,7 @@ public class AboutActivity extends AbstractViewPagerActivity super.onCreate(savedInstanceState, R.layout.viewpager_activity); int startPage = Page.VERSION.ordinal(); - Bundle extras = getIntent().getExtras(); + final Bundle extras = getIntent().getExtras(); if (extras != null) { startPage = extras.getInt(EXTRA_ABOUT_STARTPAGE, startPage); } @@ -217,7 +218,7 @@ public class AboutActivity extends AbstractViewPagerActivity return result; } - public static void showChangeLog(Context fromActivity) { + public static void showChangeLog(final Context fromActivity) { final Intent intent = new Intent(fromActivity, AboutActivity.class); intent.putExtra(EXTRA_ABOUT_STARTPAGE, Page.CHANGELOG.ordinal()); fromActivity.startActivity(intent); diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index e1c0541..f0e0ca4 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -631,7 +631,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity sortedWaypoints = new ArrayList(cache.getWaypoints()); Collections.sort(sortedWaypoints, Waypoint.WAYPOINT_COMPARATOR); - view = (ListView) getLayoutInflater().inflate(R.layout.cachedetail_waypoints_page, null); + view = (ListView) getLayoutInflater().inflate(R.layout.cachedetail_waypoints_page, parentView, false); view.setClickable(true); - final View addWaypointButton = getLayoutInflater().inflate(R.layout.cachedetail_waypoints_footer, null); + final View addWaypointButton = getLayoutInflater().inflate(R.layout.cachedetail_waypoints_footer, view, false); view.addFooterView(addWaypointButton); addWaypointButton.setOnClickListener(new View.OnClickListener() { @@ -1707,7 +1707,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity { @Override - public ListView getDispatchedView() { + public ListView getDispatchedView(final ViewGroup parentView) { if (cache == null) { // something is really wrong return null; } - view = (ListView) getLayoutInflater().inflate(R.layout.cachedetail_inventory_page, null); + view = (ListView) getLayoutInflater().inflate(R.layout.cachedetail_inventory_page, parentView, false); // TODO: fix layout, then switch back to Android-resource and delete copied one // this copy is modified to respect the text color @@ -1871,12 +1871,12 @@ public class CacheDetailActivity extends AbstractViewPagerActivity { @Override - public View getDispatchedView() { + public View getDispatchedView(final ViewGroup parentView) { if (cache == null) { return null; // something is really wrong } - view = getLayoutInflater().inflate(R.layout.cachedetail_images_page, null); + view = getLayoutInflater().inflate(R.layout.cachedetail_images_page, parentView, false); if (imagesList == null && isCurrentPage(Page.IMAGES)) { loadCacheImages(); } diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index f2c8f8e..1892cbc 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -955,17 +955,17 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } private void initAdapter() { - final ListView list = getListView(); - registerForContextMenu(list); + final ListView listView = getListView(); + registerForContextMenu(listView); adapter = new CacheListAdapter(this, cacheList, type); adapter.setFilter(currentFilter); if (listFooter == null) { - listFooter = getLayoutInflater().inflate(R.layout.cacheslist_footer, null); + listFooter = getLayoutInflater().inflate(R.layout.cacheslist_footer, listView, false); listFooter.setClickable(true); listFooter.setOnClickListener(new MoreCachesListener()); listFooterText = (TextView) listFooter.findViewById(R.id.more_caches); - list.addFooterView(listFooter); + listView.addFooterView(listFooter); } setListAdapter(adapter); adapter.forceSort(); diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java index 25906de..1ae27a3 100644 --- a/main/src/cgeo/geocaching/LogCacheActivity.java +++ b/main/src/cgeo/geocaching/LogCacheActivity.java @@ -142,7 +142,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia inventoryView.removeAllViews(); for (final TrackableLog tb : trackables) { - final LinearLayout inventoryItem = (LinearLayout) inflater.inflate(R.layout.logcache_trackable_item, null); + final LinearLayout inventoryItem = (LinearLayout) inflater.inflate(R.layout.logcache_trackable_item, inventoryView, false); ((TextView) inventoryItem.findViewById(R.id.trackcode)).setText(tb.trackCode); ((TextView) inventoryItem.findViewById(R.id.name)).setText(tb.name); diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java index 39531f1..415c7a6 100644 --- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java +++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java @@ -74,7 +74,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen @InjectView(R.id.simple_way_point_latitude) protected TextView latitude; @InjectView(R.id.date) protected TextView date; - public ViewHolder(View rowView) { + public ViewHolder(final View rowView) { super(rowView); } } @@ -82,8 +82,8 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen private static class DestinationHistoryAdapter extends ArrayAdapter { private LayoutInflater inflater = null; - public DestinationHistoryAdapter(Context context, - List objects) { + public DestinationHistoryAdapter(final Context context, + final List objects) { super(context, 0, objects); } @@ -93,7 +93,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen ViewHolder viewHolder; if (rowView == null) { - rowView = getInflater().inflate(R.layout.simple_way_point, null); + rowView = getInflater().inflate(R.layout.simple_way_point, parent, false); viewHolder = new ViewHolder(rowView); } else { @@ -105,9 +105,9 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen return rowView; } - private static void fillViewHolder(ViewHolder viewHolder, Destination loc) { - String lonString = loc.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE); - String latString = loc.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE); + private static void fillViewHolder(final ViewHolder viewHolder, final Destination loc) { + final String lonString = loc.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE); + final String latString = loc.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE); viewHolder.longitude.setText(lonString); viewHolder.latitude.setText(latString); @@ -124,7 +124,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.navigateanypoint_activity); ButterKnife.inject(this); @@ -133,7 +133,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } private void createHistoryView() { - final View pointControls = getLayoutInflater().inflate(R.layout.navigateanypoint_header, null); + final View pointControls = getLayoutInflater().inflate(R.layout.navigateanypoint_header, historyListView, false); historyListView.addHeaderView(pointControls, null, false); // inject a second time to also find the dynamically expanded views above @@ -147,8 +147,8 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen historyListView.setOnItemClickListener(new OnItemClickListener() { @Override - public void onItemClick(AdapterView arg0, View arg1, int arg2, - long arg3) { + public void onItemClick(final AdapterView arg0, final View arg1, final int arg2, + final long arg3) { final Object selection = arg0.getItemAtPosition(arg2); if (selection instanceof Destination) { navigateTo(((Destination) selection).getCoords()); @@ -158,8 +158,8 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen historyListView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { @Override - public void onCreateContextMenu(ContextMenu menu, View v, - ContextMenuInfo menuInfo) { + public void onCreateContextMenu(final ContextMenu menu, final View v, + final ContextMenuInfo menuInfo) { menu.add(Menu.NONE, CONTEXT_MENU_NAVIGATE, Menu.NONE, res.getString(R.string.cache_menu_navigate)); menu.add(Menu.NONE, CONTEXT_MENU_EDIT_WAYPOINT, Menu.NONE, R.string.waypoint_edit); menu.add(Menu.NONE, CONTEXT_MENU_DELETE_WAYPOINT, Menu.NONE, R.string.waypoint_delete); @@ -168,10 +168,10 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } @Override - public boolean onContextItemSelected(MenuItem item) { - AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); + public boolean onContextItemSelected(final MenuItem item) { + final AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); final int position = (null != menuInfo) ? menuInfo.position : contextMenuItemPosition; - Object destination = historyListView.getItemAtPosition(position); + final Object destination = historyListView.getItemAtPosition(position); switch (item.getItemId()) { case CONTEXT_MENU_NAVIGATE: @@ -203,7 +203,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen private TextView getEmptyHistoryFooter() { if (historyFooter == null) { - historyFooter = (TextView) getLayoutInflater().inflate(R.layout.cacheslist_footer, null); + historyFooter = (TextView) getLayoutInflater().inflate(R.layout.cacheslist_footer, historyListView, false); historyFooter.setText(R.string.search_history_empty); } return historyFooter; @@ -226,7 +226,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } @Override - public void onConfigurationChanged(Configuration newConfig) { + public void onConfigurationChanged(final Configuration newConfig) { super.onConfigurationChanged(newConfig); init(); @@ -273,19 +273,19 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen private class CoordDialogListener implements View.OnClickListener { @Override - public void onClick(View arg0) { + public void onClick(final View arg0) { Geopoint gp = null; if (latButton.getText().length() > 0 && lonButton.getText().length() > 0) { gp = new Geopoint(latButton.getText().toString() + " " + lonButton.getText().toString()); } - CoordinatesInputDialog coordsDialog = CoordinatesInputDialog.getInstance(null, gp, app.currentGeo()); + final CoordinatesInputDialog coordsDialog = CoordinatesInputDialog.getInstance(null, gp, app.currentGeo()); coordsDialog.setCancelable(true); coordsDialog.show(getSupportFragmentManager(),"wpedit_dialog"); } } @Override - public void updateCoordinates(Geopoint gp) { + public void updateCoordinates(final Geopoint gp) { latButton.setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE)); lonButton.setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE)); changed = true; @@ -293,42 +293,42 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen private static class ChangeDistanceUnit implements OnItemSelectedListener { - private ChangeDistanceUnit(NavigateAnyPointActivity unitView) { + private ChangeDistanceUnit(final NavigateAnyPointActivity unitView) { this.unitView = unitView; } - private NavigateAnyPointActivity unitView; + private final NavigateAnyPointActivity unitView; @Override - public void onItemSelected(AdapterView arg0, View arg1, int arg2, - long arg3) { + public void onItemSelected(final AdapterView arg0, final View arg1, final int arg2, + final long arg3) { unitView.distanceUnit = (String) arg0.getItemAtPosition(arg2); } @Override - public void onNothingSelected(AdapterView arg0) { + public void onNothingSelected(final AdapterView arg0) { } } @Override - public boolean onCreateOptionsMenu(Menu menu) { + public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.navigate_any_point_activity_options, menu); menu.findItem(R.id.menu_default_navigation).setTitle(NavigationAppFactory.getDefaultNavigationApplication().getName()); return true; } @Override - public boolean onPrepareOptionsMenu(Menu menu) { + public boolean onPrepareOptionsMenu(final Menu menu) { super.onPrepareOptionsMenu(menu); try { - boolean visible = getDestination() != null; + final boolean visible = getDestination() != null; menu.findItem(R.id.menu_navigate).setVisible(visible); menu.findItem(R.id.menu_default_navigation).setVisible(visible); menu.findItem(R.id.menu_caches_around).setVisible(visible); menu.findItem(R.id.menu_clear_history).setVisible(!getHistoryOfSearchedLocations().isEmpty()); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { // nothing } @@ -336,7 +336,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } @Override - public boolean onOptionsItemSelected(MenuItem item) { + public boolean onOptionsItemSelected(final MenuItem item) { final int menuItem = item.getItemId(); final Geopoint coords = getDestination(); @@ -387,7 +387,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } } - private void removeFromHistory(Destination destination) { + private void removeFromHistory(final Destination destination) { if (getHistoryOfSearchedLocations().contains(destination)) { getHistoryOfSearchedLocations().remove(destination); @@ -427,7 +427,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen navigateTo(getDestination()); } - private void navigateTo(Geopoint geopoint) { + private void navigateTo(final Geopoint geopoint) { NavigationAppFactory.startDefaultNavigationApplication(1, this, geopoint); } @@ -459,7 +459,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen private class CurrentListener implements View.OnClickListener { @Override - public void onClick(View arg0) { + public void onClick(final View arg0) { final Geopoint coords = app.currentGeo().getCoords(); if (coords == null) { showToast(res.getString(R.string.err_point_unknown_position)); @@ -474,11 +474,11 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen } private Geopoint getDestination() { - String bearingText = bearingEditText.getText().toString(); + final String bearingText = bearingEditText.getText().toString(); // combine distance from EditText and distanceUnit saved from Spinner - String distanceText = distanceEditText.getText().toString() + distanceUnit; - String latText = latButton.getText().toString(); - String lonText = lonButton.getText().toString(); + final String distanceText = distanceEditText.getText().toString() + distanceUnit; + final String latText = latButton.getText().toString(); + final String lonText = lonButton.getText().toString(); if (StringUtils.isBlank(bearingText) && StringUtils.isBlank(distanceText) && StringUtils.isBlank(latText) && StringUtils.isBlank(lonText)) { @@ -491,7 +491,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen if (StringUtils.isNotBlank(latText) && StringUtils.isNotBlank(lonText)) { try { coords = new Geopoint(latText, lonText); - } catch (Geopoint.ParseException e) { + } catch (final Geopoint.ParseException e) { showToast(res.getString(e.resource)); return null; } @@ -510,7 +510,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen double bearing; try { bearing = Double.parseDouble(bearingText); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { Dialogs.message(this, R.string.err_point_bear_and_dist_title, R.string.err_point_bear_and_dist); return null; } @@ -519,7 +519,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen try { distance = DistanceParser.parseDistance(distanceText, !Settings.isUseImperialUnits()); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { showToast(res.getString(R.string.err_parse_dist)); return null; } diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index 134e134..dd578a2 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -62,7 +62,7 @@ public class StaticMapsActivity extends AbstractActionBarActivity { } else { showStaticMaps(); } - } catch (Exception e) { + } catch (final Exception e) { Log.e("StaticMapsActivity.loadMapsHandler", e); } } @@ -83,7 +83,7 @@ public class StaticMapsActivity extends AbstractActionBarActivity { for (final Bitmap image : maps) { if (image != null) { - final ImageView map = (ImageView) inflater.inflate(R.layout.staticmaps_activity_item, null); + final ImageView map = (ImageView) inflater.inflate(R.layout.staticmaps_activity_item, smapsView, false); map.setImageBitmap(image); smapsView.addView(map); } @@ -127,7 +127,7 @@ public class StaticMapsActivity extends AbstractActionBarActivity { maps.add(image); } } - } catch (Exception e) { + } catch (final Exception e) { Log.e("StaticMapsActivity.LoadMapsThread.run", e); } } @@ -137,7 +137,7 @@ public class StaticMapsActivity extends AbstractActionBarActivity { } loadMapsHandler.sendMessage(Message.obtain()); - } catch (Exception e) { + } catch (final Exception e) { Log.e("StaticMapsActivity.LoadMapsThread.run", e); } } diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java index 2a228c1..e8d16ca 100644 --- a/main/src/cgeo/geocaching/TrackableActivity.java +++ b/main/src/cgeo/geocaching/TrackableActivity.java @@ -46,6 +46,7 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; @@ -372,8 +373,8 @@ public class TrackableActivity extends AbstractViewPagerActivity> extends } @Override - public void startUpdate(ViewGroup arg0) { + public void startUpdate(final ViewGroup arg0) { } @Override - public int getItemPosition(Object object) { + public int getItemPosition(final Object object) { // We are doing the caching. So pretend that the view is gone. // The ViewPager will get it back in instantiateItem() return POSITION_NONE; } @Override - public String getTitle(int position) { + public String getTitle(final int position) { final Page page = pageOrder.get(position); if (null == page) { return ""; @@ -216,7 +218,7 @@ public abstract class AbstractViewPagerActivity> extends * @param pageSelectedListener * page selection listener or null */ - protected final void createViewPager(int startPageIndex, final OnPageSelectedListener pageSelectedListener) { + protected final void createViewPager(final int startPageIndex, final OnPageSelectedListener pageSelectedListener) { // initialize ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); viewPagerAdapter = new ViewPagerAdapter(); @@ -227,16 +229,16 @@ public abstract class AbstractViewPagerActivity> extends if (pageSelectedListener != null) { titleIndicator.setOnPageChangeListener(new OnPageChangeListener() { @Override - public void onPageSelected(int position) { + public void onPageSelected(final int position) { pageSelectedListener.onPageSelected(position); } @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + public void onPageScrolled(final int position, final float positionOffset, final int positionOffsetPixels) { } @Override - public void onPageScrollStateChanged(int state) { + public void onPageScrollStateChanged(final int state) { } }); } @@ -267,11 +269,11 @@ public abstract class AbstractViewPagerActivity> extends protected final void reinitializeViewPager() { // notify all creators that the data has changed - for (PageViewCreator creator : viewCreators.values()) { + for (final PageViewCreator creator : viewCreators.values()) { creator.notifyDataSetChanged(); } // reset the stored view states of all pages - for (Bundle state : viewStates.values()) { + for (final Bundle state : viewStates.values()) { state.clear(); } @@ -301,19 +303,19 @@ public abstract class AbstractViewPagerActivity> extends */ protected abstract Pair, Integer> getOrderedPages(); - public final Page getPage(int position) { + public final Page getPage(final int position) { return pageOrder.get(position); } - protected final int getPageIndex(Page page) { + protected final int getPageIndex(final Page page) { return pageOrder.indexOf(page); } - protected final PageViewCreator getViewCreator(Page page) { + protected final PageViewCreator getViewCreator(final Page page) { return viewCreators.get(page); } - protected final boolean isCurrentPage(Page page) { + protected final boolean isCurrentPage(final Page page) { return getCurrentItem() == getPageIndex(page); } diff --git a/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java b/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java index 5327bea..c6d8dfe 100644 --- a/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java +++ b/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java @@ -6,12 +6,14 @@ import cgeo.geocaching.network.Network; import cgeo.geocaching.utils.Log; import org.apache.commons.io.IOUtils; + import rx.Observable; import rx.android.observables.AndroidObservable; import rx.functions.Action1; import rx.functions.Func0; import rx.schedulers.Schedulers; +import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; @@ -71,11 +73,12 @@ public class RecaptchaHandler extends Handler { reloadButton.setEnabled(true); } + @SuppressLint("InflateParams") @Override - public void handleMessage(Message msg) { + public void handleMessage(final Message msg) { if (msg.what == SHOW_CAPTCHA) { final AlertDialog.Builder dlg = new AlertDialog.Builder(activity); - final View view = activity.getLayoutInflater().inflate(R.layout.recaptcha_dialog, null); + final View view = activity.getLayoutInflater().inflate(R.layout.recaptcha_dialog, null, false); final ImageView imageView = (ImageView) view.findViewById(R.id.image); @@ -83,7 +86,7 @@ public class RecaptchaHandler extends Handler { reloadButton.setEnabled(false); reloadButton.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View v) { + public void onClick(final View v) { recaptchaReceiver.fetchChallenge(); loadChallenge(imageView, reloadButton); } @@ -95,7 +98,7 @@ public class RecaptchaHandler extends Handler { dlg.setView(view); dlg.setNeutralButton(activity.getString(R.string.caches_recaptcha_continue), new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int id) { + public void onClick(final DialogInterface dialog, final int id) { final String text = ((EditText) view.findViewById(R.id.text)).getText().toString(); recaptchaReceiver.setText(text); dialog.cancel(); diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java index 71cd3b4..306c686 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java @@ -3,11 +3,13 @@ package cgeo.geocaching.ui; import cgeo.geocaching.activity.AbstractViewPagerActivity.PageViewCreator; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import android.os.Bundle; import android.view.View; +import android.view.ViewGroup; /** * View creator which destroys the created view on every {@link #notifyDataSetChanged()}. @@ -24,9 +26,9 @@ public abstract class AbstractCachingPageViewCreator imp } @Override - public final View getView() { + public final View getView(final ViewGroup parentView) { if (view == null) { - view = getDispatchedView(); + view = getDispatchedView(parentView); } return view; @@ -34,7 +36,7 @@ public abstract class AbstractCachingPageViewCreator imp @Override @SuppressFBWarnings("USM_USELESS_ABSTRACT_METHOD") - public abstract ViewClass getDispatchedView(); + public abstract ViewClass getDispatchedView(final ViewGroup parentView); /** * Gets the state of the view but returns an empty state if not overridden @@ -51,6 +53,6 @@ public abstract class AbstractCachingPageViewCreator imp * Restores the state of the view but just returns if not overridden. */ @Override - public void setViewState(@NonNull Bundle state) { + public void setViewState(@NonNull final Bundle state) { } } diff --git a/main/src/cgeo/geocaching/ui/AddressListAdapter.java b/main/src/cgeo/geocaching/ui/AddressListAdapter.java index 8134235..5d16df5 100644 --- a/main/src/cgeo/geocaching/ui/AddressListAdapter.java +++ b/main/src/cgeo/geocaching/ui/AddressListAdapter.java @@ -29,7 +29,7 @@ public class AddressListAdapter extends ArrayAdapter
{ @InjectView(R.id.label) protected TextView label; @InjectView(R.id.distance) protected TextView distance; - public ViewHolder(View view) { + public ViewHolder(final View view) { super(view); } } @@ -49,7 +49,7 @@ public class AddressListAdapter extends ArrayAdapter
{ // holder pattern implementation final ViewHolder holder; if (view == null) { - view = inflater.inflate(R.layout.addresslist_item, null); + view = inflater.inflate(R.layout.addresslist_item, parent, false); holder = new ViewHolder(view); } else { holder = (ViewHolder) view.getTag(); diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java index 5d8ebef..6d44554 100644 --- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java +++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java @@ -45,7 +45,7 @@ public final class CacheDetailsCreator { * @return the view containing the displayed string (i.e. the right side one from the pair of "label": "value") */ public TextView add(final int nameId, final CharSequence value) { - final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, null); + final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, parentView, false); final TextView nameView = (TextView) layout.findViewById(R.id.name); nameView.setText(res.getString(nameId)); lastValueView = (TextView) layout.findViewById(R.id.value); @@ -63,7 +63,7 @@ public final class CacheDetailsCreator { } public RelativeLayout addStars(final int nameId, final float value, final int max) { - final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, null); + final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, parentView, false); final TextView nameView = (TextView) layout.findViewById(R.id.name); lastValueView = (TextView) layout.findViewById(R.id.value); final LinearLayout layoutStars = (LinearLayout) layout.findViewById(R.id.stars); @@ -81,7 +81,7 @@ public final class CacheDetailsCreator { final LayoutInflater inflater = LayoutInflater.from(activity); for (int i = 0; i < max; i++) { - ImageView star = (ImageView) inflater.inflate(R.layout.star_image, null); + final ImageView star = (ImageView) inflater.inflate(R.layout.star_image, starsContainer, false); if (value - i >= 0.75) { star.setImageResource(R.drawable.star_on); } else if (value - i >= 0.25) { @@ -93,7 +93,7 @@ public final class CacheDetailsCreator { } } - public void addCacheState(Geocache cache) { + public void addCacheState(final Geocache cache) { if (cache.isLogOffline() || cache.isArchived() || cache.isDisabled() || cache.isPremiumMembersOnly() || cache.isFound()) { final List states = new ArrayList(5); if (cache.isLogOffline()) { @@ -115,7 +115,7 @@ public final class CacheDetailsCreator { } } - public void addRating(Geocache cache) { + public void addRating(final Geocache cache) { if (cache.getRating() > 0) { final RelativeLayout itemLayout = addStars(R.string.cache_rating, cache.getRating()); if (cache.getVotes() > 0) { @@ -126,19 +126,19 @@ public final class CacheDetailsCreator { } } - public void addSize(Geocache cache) { + public void addSize(final Geocache cache) { if (null != cache.getSize() && cache.showSize()) { add(R.string.cache_size, cache.getSize().getL10n()); } } - public void addDifficulty(Geocache cache) { + public void addDifficulty(final Geocache cache) { if (cache.getDifficulty() > 0) { addStars(R.string.cache_difficulty, cache.getDifficulty()); } } - public void addTerrain(Geocache cache) { + public void addTerrain(final Geocache cache) { if (cache.getTerrain() > 0) { addStars(R.string.cache_terrain, cache.getTerrain(), ConnectorFactory.getConnector(cache).getMaxTerrain()); } @@ -189,7 +189,7 @@ public final class CacheDetailsCreator { add(R.string.cache_distance, text); } - public void addEventDate(@NonNull Geocache cache) { + public void addEventDate(@NonNull final Geocache cache) { if (!cache.isEventCache()) { return; } diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 3a451a5..2de1140 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -63,7 +63,7 @@ public class CacheListAdapter extends ArrayAdapter { private boolean selectMode = false; private IFilter currentFilter = null; private List originalList = null; - private boolean isLiveList = Settings.isLiveList(); + private final boolean isLiveList = Settings.isLiveList(); final private Set compasses = new LinkedHashSet(); final private Set distances = new LinkedHashSet(); @@ -110,12 +110,12 @@ public class CacheListAdapter extends ArrayAdapter { @InjectView(R.id.direction) protected CompassMiniView direction; @InjectView(R.id.dirimg) protected ImageView dirImg; - public ViewHolder(View view) { + public ViewHolder(final View view) { super(view); } } - public CacheListAdapter(final Activity activity, final List list, CacheListType cacheListType) { + public CacheListAdapter(final Activity activity, final List list, final CacheListType cacheListType) { super(activity, 0, list); final IGeoData currentGeo = CgeoApplication.getInstance().currentGeo(); if (currentGeo != null) { @@ -133,10 +133,10 @@ public class CacheListAdapter extends ArrayAdapter { gcIconDrawables.put(hashCode, activity.getResources().getDrawable(cacheType.markerId)); // icon with flag for user modified coordinates hashCode = getIconHashCode(cacheType, true); - Drawable[] layers = new Drawable[2]; + final Drawable[] layers = new Drawable[2]; layers[0] = activity.getResources().getDrawable(cacheType.markerId); layers[1] = modifiedCoordinatesMarker; - LayerDrawable ld = new LayerDrawable(layers); + final LayerDrawable ld = new LayerDrawable(layers); ld.setLayerInset(1, layers[0].getIntrinsicWidth() - layers[1].getIntrinsicWidth(), layers[0].getIntrinsicHeight() - layers[1].getIntrinsicHeight(), @@ -184,7 +184,7 @@ public class CacheListAdapter extends ArrayAdapter { return cacheListType == CacheListType.HISTORY; } - public Geocache findCacheByGeocode(String geocode) { + public Geocache findCacheByGeocode(final String geocode) { for (int i = 0; i < getCount(); i++) { if (getItem(i).getGeocode().equalsIgnoreCase(geocode)) { return getItem(i); @@ -240,7 +240,7 @@ public class CacheListAdapter extends ArrayAdapter { public int getCheckedCount() { int checked = 0; - for (Geocache cache : list) { + for (final Geocache cache : list) { if (cache.isStatusChecked()) { checked++; } @@ -268,7 +268,7 @@ public class CacheListAdapter extends ArrayAdapter { } public void invertSelection() { - for (Geocache cache : list) { + for (final Geocache cache : list) { cache.setStatusChecked(!cache.isStatusChecked()); } notifyDataSetChanged(); @@ -369,7 +369,7 @@ public class CacheListAdapter extends ArrayAdapter { final ViewHolder holder; if (v == null) { - v = inflater.inflate(R.layout.cacheslist_item, null); + v = inflater.inflate(R.layout.cacheslist_item, parent, false); holder = new ViewHolder(v); } else { @@ -502,7 +502,7 @@ public class CacheListAdapter extends ArrayAdapter { return v; } - private static Drawable getCacheIcon(Geocache cache) { + private static Drawable getCacheIcon(final Geocache cache) { int hashCode = getIconHashCode(cache.getType(), cache.hasUserModifiedCoords() || cache.hasFinalDefined()); final Drawable drawable = gcIconDrawables.get(hashCode); if (drawable != null) { @@ -525,12 +525,12 @@ public class CacheListAdapter extends ArrayAdapter { private final Geocache cache; - public SelectionCheckBoxListener(Geocache cache) { + public SelectionCheckBoxListener(final Geocache cache) { this.cache = cache; } @Override - public void onClick(View view) { + public void onClick(final View view) { assert view instanceof CheckBox; final boolean checkNow = ((CheckBox) view).isChecked(); cache.setStatusChecked(checkNow); @@ -590,7 +590,7 @@ public class CacheListAdapter extends ArrayAdapter { } @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + public boolean onFling(final MotionEvent e1, final MotionEvent e2, final float velocityX, final float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) { return false; @@ -616,7 +616,7 @@ public class CacheListAdapter extends ArrayAdapter { } return true; } - } catch (Exception e) { + } catch (final Exception e) { Log.w("CacheListAdapter.FlingGesture.onFling", e); } @@ -630,7 +630,7 @@ public class CacheListAdapter extends ArrayAdapter { public List getCheckedCaches() { final ArrayList result = new ArrayList(); - for (Geocache cache : list) { + for (final Geocache cache : list) { if (cache.isStatusChecked()) { result.add(cache); } diff --git a/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java b/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java index c325f50..e07bbc3 100644 --- a/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java +++ b/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java @@ -22,7 +22,7 @@ public class FileSelectionListAdapter extends ArrayAdapter { private final IFileSelectionView parentView; private final LayoutInflater inflater; - public FileSelectionListAdapter(IFileSelectionView parentIn, List listIn) { + public FileSelectionListAdapter(final IFileSelectionView parentIn, final List listIn) { super(parentIn.getContext(), 0, listIn); parentView = parentIn; @@ -36,19 +36,19 @@ public class FileSelectionListAdapter extends ArrayAdapter { return null; } - File file = getItem(position); + final File file = getItem(position); View v = rowView; ViewHolder holder; if (v == null) { - v = inflater.inflate(R.layout.mapfile_item, null); + v = inflater.inflate(R.layout.mapfile_item, parent, false); holder = new ViewHolder(v); } else { holder = (ViewHolder) v.getTag(); } - String currentFile = parentView.getCurrentFile(); + final String currentFile = parentView.getCurrentFile(); if (currentFile != null && file.equals(new File(currentFile))) { holder.filename.setTypeface(holder.filename.getTypeface(), Typeface.BOLD); } else { @@ -67,13 +67,13 @@ public class FileSelectionListAdapter extends ArrayAdapter { private class TouchListener implements View.OnClickListener { private File file = null; - public TouchListener(File fileIn) { + public TouchListener(final File fileIn) { file = fileIn; } // tap on item @Override - public void onClick(View view) { + public void onClick(final View view) { parentView.setCurrentFile(file.toString()); parentView.close(); } @@ -83,7 +83,7 @@ public class FileSelectionListAdapter extends ArrayAdapter { @InjectView(R.id.mapfilepath) protected TextView filepath; @InjectView(R.id.mapfilename) protected TextView filename; - public ViewHolder(View view) { + public ViewHolder(final View view) { super(view); } } diff --git a/main/src/cgeo/geocaching/ui/GPXListAdapter.java b/main/src/cgeo/geocaching/ui/GPXListAdapter.java index ae18ab4..5db103b 100644 --- a/main/src/cgeo/geocaching/ui/GPXListAdapter.java +++ b/main/src/cgeo/geocaching/ui/GPXListAdapter.java @@ -28,12 +28,12 @@ public class GPXListAdapter extends ArrayAdapter { @InjectView(R.id.filepath) protected TextView filepath; @InjectView(R.id.filename) protected TextView filename; - public ViewHolder(View view) { + public ViewHolder(final View view) { super(view); } } - public GPXListAdapter(GpxFileListActivity parentIn, List listIn) { + public GPXListAdapter(final GpxFileListActivity parentIn, final List listIn) { super(parentIn, 0, listIn); activity = parentIn; @@ -53,7 +53,7 @@ public class GPXListAdapter extends ArrayAdapter { final ViewHolder holder; if (view == null) { - view = inflater.inflate(R.layout.gpx_item, null); + view = inflater.inflate(R.layout.gpx_item, parent, false); holder = new ViewHolder(view); } else { holder = (ViewHolder) view.getTag(); @@ -62,7 +62,7 @@ public class GPXListAdapter extends ArrayAdapter { view.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View v) { + public void onClick(final View v) { (new GPXImporter(activity, activity.getListId(), null)).importGPX(file); } }); @@ -73,10 +73,10 @@ public class GPXListAdapter extends ArrayAdapter { view.setOnLongClickListener(new View.OnLongClickListener() { @Override - public boolean onLongClick(View v) { + public boolean onLongClick(final View v) { Dialogs.confirmYesNo(activity, R.string.gpx_import_delete_title, activity.getString(R.string.gpx_import_delete_message, file.getName()), new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int id) { + public void onClick(final DialogInterface dialog, final int id) { FileUtils.deleteIgnoringFailure(file); GPXListAdapter.this.remove(file); } diff --git a/main/src/cgeo/geocaching/ui/ImagesList.java b/main/src/cgeo/geocaching/ui/ImagesList.java index 5727971..bf53725 100644 --- a/main/src/cgeo/geocaching/ui/ImagesList.java +++ b/main/src/cgeo/geocaching/ui/ImagesList.java @@ -9,6 +9,7 @@ import cgeo.geocaching.utils.Log; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; + import rx.Subscription; import rx.android.observables.AndroidObservable; import rx.functions.Action0; @@ -102,7 +103,7 @@ public class ImagesList { final HtmlImage imgGetter = new HtmlImage(geocode, true, offline ? StoredList.STANDARD_LIST_ID : StoredList.TEMPORARY_LIST_ID, false); for (final Image img : images) { - final LinearLayout rowView = (LinearLayout) inflater.inflate(R.layout.cache_image_item, null); + final LinearLayout rowView = (LinearLayout) inflater.inflate(R.layout.cache_image_item, imagesView, false); assert(rowView != null); if (StringUtils.isNotBlank(img.getTitle())) { @@ -116,7 +117,7 @@ public class ImagesList { descView.setVisibility(View.VISIBLE); } - final ImageView imageView = (ImageView) inflater.inflate(R.layout.image_item, null); + final ImageView imageView = (ImageView) inflater.inflate(R.layout.image_item, rowView, false); assert(imageView != null); subscriptions.add(AndroidObservable.bindActivity(activity, imgGetter.fetchDrawable(img.getUrl())).subscribe(new Action1() { @Override @@ -141,7 +142,7 @@ public class ImagesList { imageView.setClickable(true); imageView.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View arg0) { + public void onClick(final View arg0) { viewImageInStandardApp(img, image); } }); @@ -169,7 +170,7 @@ public class ImagesList { imagesView.removeAllViews(); } - public void onCreateContextMenu(ContextMenu menu, View v) { + public void onCreateContextMenu(final ContextMenu menu, final View v) { assert v instanceof ImageView; activity.getMenuInflater().inflate(R.menu.images_list_context, menu); final Resources res = activity.getResources(); @@ -179,7 +180,7 @@ public class ImagesList { currentImage = images.get(view.getId()); } - public boolean onContextItemSelected(MenuItem item) { + public boolean onContextItemSelected(final MenuItem item) { switch (item.getItemId()) { case R.id.image_open_file: viewImageInStandardApp(currentImage, currentDrawable); @@ -221,7 +222,7 @@ public class ImagesList { intent.setDataAndType(Uri.fromFile(saveToTemporaryJPGFile(image)), "image/jpeg"); } activity.startActivity(intent); - } catch (Exception e) { + } catch (final Exception e) { Log.e("ImagesList.viewImageInStandardApp", e); } } diff --git a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java index 6590d22..1f6706c 100644 --- a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java +++ b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java @@ -23,6 +23,7 @@ import android.os.AsyncTask; import android.text.Html; import android.text.Spanned; import android.view.View; +import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; @@ -34,19 +35,19 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre protected final AbstractActivity activity; - public LogsViewCreator(AbstractActivity activity) { + public LogsViewCreator(final AbstractActivity activity) { this.activity = activity; } @Override - public ListView getDispatchedView() { + public ListView getDispatchedView(final ViewGroup parentView) { if (!isValid()) { return null; } final List logs = getLogs(); - view = (ListView) activity.getLayoutInflater().inflate(R.layout.logs_page, null); + view = (ListView) activity.getLayoutInflater().inflate(R.layout.logs_page, parentView, false); addHeaderView(); view.setAdapter(new ArrayAdapter(activity, R.layout.logs_item, logs) { @@ -54,7 +55,7 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre public View getView(final int position, final View convertView, final android.view.ViewGroup parent) { View rowView = convertView; if (null == rowView) { - rowView = activity.getLayoutInflater().inflate(R.layout.logs_item, null); + rowView = activity.getLayoutInflater().inflate(R.layout.logs_item, parent, false); } LogViewHolder holder = (LogViewHolder) rowView.getTag(); if (null == holder) { @@ -71,7 +72,7 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre return view; } - protected void fillViewHolder(final View convertView, LogViewHolder holder, final LogEntry log) { + protected void fillViewHolder(final View convertView, final LogViewHolder holder, final LogEntry log) { if (log.date > 0) { holder.date.setText(Formatter.formatShortDateVerbally(log.date)); holder.date.setVisibility(View.VISIBLE); @@ -108,7 +109,7 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre holder.images.setVisibility(View.VISIBLE); holder.images.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(View v) { + public void onClick(final View v) { ImagesActivity.startActivityLogImages(activity, getGeocode(), new ArrayList(log.getLogImages())); } }); @@ -152,18 +153,18 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre final private LogViewHolder holder; final private int position; - public LogImageLoader(LogViewHolder holder) { + public LogImageLoader(final LogViewHolder holder) { this.holder = holder; this.position = holder.getPosition(); } @Override - protected Spanned doInBackground(String... logtext) { + protected Spanned doInBackground(final String... logtext) { return Html.fromHtml(logtext[0], new HtmlImage(getGeocode(), false, StoredList.STANDARD_LIST_ID, false), null); //, TextView.BufferType.SPANNABLE) } @Override - protected void onPostExecute(Spanned result) { + protected void onPostExecute(final Spanned result) { // Ensure that this holder and its view still references the right item before updating the text. if (position == holder.getPosition()) { holder.text.setText(result); -- cgit v1.1