aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-07-09 20:00:20 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-07-09 20:00:20 +0200
commit39c1a333586fc0cbe61b9f18f5abe33c5f7bba2b (patch)
treec16fb9a6910842b6d77f45a241e70bc9076bd239
parentd958893efe7f492ebe909ba74f6e27ea2cb1532c (diff)
downloadcgeo-39c1a333586fc0cbe61b9f18f5abe33c5f7bba2b.zip
cgeo-39c1a333586fc0cbe61b9f18f5abe33c5f7bba2b.tar.gz
cgeo-39c1a333586fc0cbe61b9f18f5abe33c5f7bba2b.tar.bz2
remove some findbugs issues
* unused code * convert explicit type casts to generic method invocations
-rw-r--r--main/src/cgeo/geocaching/AbstractDialogFragment.java50
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java53
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java4
-rw-r--r--main/src/cgeo/geocaching/CgeoApplication.java13
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java22
-rw-r--r--main/src/cgeo/geocaching/StatusFragment.java9
-rw-r--r--main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java9
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java6
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java6
-rw-r--r--main/src/cgeo/geocaching/files/SimpleDirChooser.java84
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java15
-rw-r--r--main/src/cgeo/geocaching/settings/TemplateTextPreference.java30
-rw-r--r--main/src/cgeo/geocaching/settings/TextPreference.java20
-rw-r--r--main/src/cgeo/geocaching/settings/WpThresholdPreference.java24
-rw-r--r--main/src/cgeo/geocaching/ui/CacheDetailsCreator.java14
-rw-r--r--main/src/cgeo/geocaching/ui/CompassView.java19
-rw-r--r--main/src/cgeo/geocaching/ui/EditNoteDialog.java22
-rw-r--r--main/src/cgeo/geocaching/ui/ImagesList.java9
-rw-r--r--main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java48
-rw-r--r--main/src/cgeo/geocaching/ui/dialog/CustomProgressDialog.java19
-rw-r--r--main/src/cgeo/geocaching/ui/dialog/DateDialog.java16
21 files changed, 258 insertions, 234 deletions
diff --git a/main/src/cgeo/geocaching/AbstractDialogFragment.java b/main/src/cgeo/geocaching/AbstractDialogFragment.java
index f242fc9..4025347 100644
--- a/main/src/cgeo/geocaching/AbstractDialogFragment.java
+++ b/main/src/cgeo/geocaching/AbstractDialogFragment.java
@@ -1,5 +1,7 @@
package cgeo.geocaching;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.enumerations.CacheSize;
@@ -56,26 +58,26 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
res = getResources();
app = (CgeoApplication) getActivity().getApplication();
setHasOptionsMenu(true);
}
- protected void initCustomActionBar(View v)
+ protected void initCustomActionBar(final View v)
{
- final ImageView defaultNavigationImageView = (ImageView) v.findViewById(R.id.defaultNavigation);
+ final ImageView defaultNavigationImageView = ButterKnife.findById(v, R.id.defaultNavigation);
defaultNavigationImageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
- public boolean onLongClick(View v) {
+ public boolean onLongClick(final View v) {
startDefaultNavigation2();
return true;
}
});
defaultNavigationImageView.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(final View v) {
navigateTo();
}
});
@@ -83,7 +85,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
final View overflowActionBar = v.findViewById(R.id.overflowActionBar);
overflowActionBar.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(final View v) {
showPopup(v);
}
});
@@ -109,7 +111,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
}
- protected void showPopup(View view)
+ protected void showPopup(final View view)
{
// For reason I totally not understand the PopupMenu from Appcompat is broken beyond
// repair. Chicken out here and show the old menu on Gingerbread.
@@ -124,13 +126,13 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void showPopupHoneycomb(View view) {
- android.widget.PopupMenu popupMenu = new android.widget.PopupMenu(getActivity(), view);
+ private void showPopupHoneycomb(final View view) {
+ final android.widget.PopupMenu popupMenu = new android.widget.PopupMenu(getActivity(), view);
CacheMenuHandler.addMenuItems(new MenuInflater(getActivity()), popupMenu.getMenu(), cache);
popupMenu.setOnMenuItemClickListener(
new android.widget.PopupMenu.OnMenuItemClickListener() {
@Override
- public boolean onMenuItemClick(MenuItem item) {
+ public boolean onMenuItemClick(final MenuItem item) {
return AbstractDialogFragment.this.onMenuItemClick(item);
}
}
@@ -138,9 +140,9 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
popupMenu.show();
}
- protected void showPopupCompat(View view)
+ protected void showPopupCompat(final View view)
{
- PopupMenu popupMenu = new PopupMenu(getActivity(), view);
+ final PopupMenu popupMenu = new PopupMenu(getActivity(), view);
// Directly instantiate SupportMenuInflater instead of getActivity().getMenuinflator
// getMenuinflator will throw a NPE since it tries to get the not displayed ActionBar
@@ -238,7 +240,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
buttonMore.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View arg0) {
+ public void onClick(final View arg0) {
CacheDetailActivity.startActivity(getActivity(), geocode);
getActivity().finish();
}
@@ -248,7 +250,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
registerForContextMenu(buttonMore);
}
- public final void showToast(String text) {
+ public final void showToast(final String text) {
ActivityMixin.showToast(getActivity(), text);
}
@@ -277,35 +279,35 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
}
@Override
- public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
CacheMenuHandler.addMenuItems(inflater, menu, cache);
}
@Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
CacheMenuHandler.addMenuItems(new MenuInflater(getActivity()), menu, cache);
for (int i=0;i<menu.size();i++) {
- MenuItem m = menu.getItem(i);
+ final MenuItem m = menu.getItem(i);
m.setOnMenuItemClickListener(this);
}
}
@Override
- public boolean onContextItemSelected(MenuItem item) {
+ public boolean onContextItemSelected(final MenuItem item) {
return onOptionsItemSelected(item);
}
@Override
- public boolean onMenuItemClick(MenuItem menuItem) {
+ public boolean onMenuItemClick(final MenuItem menuItem) {
return onOptionsItemSelected(menuItem);
}
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
+ public boolean onOptionsItemSelected(final MenuItem item) {
if (CacheMenuHandler.onMenuItemSelected(item, this, cache)) {
return true;
}
@@ -317,7 +319,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
}
@Override
- public void onPrepareOptionsMenu(Menu menu) {
+ public void onPrepareOptionsMenu(final Menu menu) {
super.onPrepareOptionsMenu(menu);
try {
@@ -346,13 +348,9 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
}
@Override
- public void onCancel(DialogInterface dialog) {
+ public void onCancel(final DialogInterface dialog) {
super.onCancel(dialog);
getActivity().finish();
}
- @Override
- public void onDestroyView() {
- super.onDestroyView();
- }
}
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 99dc34d..4b14930 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -918,14 +918,14 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
public void call(final BitmapDrawable image) {
final Bitmap bitmap = image.getBitmap();
if (bitmap != null && bitmap.getWidth() > 10) {
- final ImageView imageView = (ImageView) view.findViewById(R.id.map_preview);
+ final ImageView imageView = ButterKnife.findById(view, R.id.map_preview);
imageView.setImageDrawable(image);
view.findViewById(R.id.map_preview_box).setVisibility(View.VISIBLE);
}
}
});
- detailsList = (LinearLayout) view.findViewById(R.id.details_list);
+ detailsList = ButterKnife.findById(view, R.id.details_list);
final CacheDetailsCreator details = new CacheDetailsCreator(CacheDetailActivity.this, detailsList);
// cache name (full name)
@@ -991,28 +991,29 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
// cache attributes
if (!cache.getAttributes().isEmpty()) {
- new AttributeViewBuilder().fillView((LinearLayout) view.findViewById(R.id.attributes_innerbox));
+ final LinearLayout innerLayout = ButterKnife.findById(view, R.id.attributes_innerbox);
+ new AttributeViewBuilder().fillView(innerLayout);
view.findViewById(R.id.attributes_box).setVisibility(View.VISIBLE);
}
updateOfflineBox(view, cache, res, new RefreshCacheClickListener(), new DropCacheClickListener(), new StoreCacheClickListener());
// watchlist
- final Button buttonWatchlistAdd = (Button) view.findViewById(R.id.add_to_watchlist);
- final Button buttonWatchlistRemove = (Button) view.findViewById(R.id.remove_from_watchlist);
+ final Button buttonWatchlistAdd = ButterKnife.findById(view, R.id.add_to_watchlist);
+ final Button buttonWatchlistRemove = ButterKnife.findById(view, R.id.remove_from_watchlist);
buttonWatchlistAdd.setOnClickListener(new AddToWatchlistClickListener());
buttonWatchlistRemove.setOnClickListener(new RemoveFromWatchlistClickListener());
updateWatchlistBox();
// favorite points
- final Button buttonFavPointAdd = (Button) view.findViewById(R.id.add_to_favpoint);
- final Button buttonFavPointRemove = (Button) view.findViewById(R.id.remove_from_favpoint);
+ final Button buttonFavPointAdd = ButterKnife.findById(view, R.id.add_to_favpoint);
+ final Button buttonFavPointRemove = ButterKnife.findById(view, R.id.remove_from_favpoint);
buttonFavPointAdd.setOnClickListener(new FavoriteAddClickListener());
buttonFavPointRemove.setOnClickListener(new FavoriteRemoveClickListener());
updateFavPointBox();
// list
- final Button buttonChangeList = (Button) view.findViewById(R.id.change_list);
+ final Button buttonChangeList = ButterKnife.findById(view, R.id.change_list);
buttonChangeList.setOnClickListener(new ChangeListClickListener());
updateListBox();
@@ -1021,7 +1022,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
final String license = connector.getLicenseText(cache);
if (StringUtils.isNotBlank(license)) {
view.findViewById(R.id.license_box).setVisibility(View.VISIBLE);
- final TextView licenseView = ((TextView) view.findViewById(R.id.license));
+ final TextView licenseView = (ButterKnife.findById(view, R.id.license));
licenseView.setText(Html.fromHtml(license), BufferType.SPANNABLE);
licenseView.setClickable(true);
licenseView.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
@@ -1254,15 +1255,15 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
* shows/hides buttons, sets text in watchlist box
*/
private void updateWatchlistBox() {
- final LinearLayout layout = (LinearLayout) view.findViewById(R.id.watchlist_box);
+ final LinearLayout layout = ButterKnife.findById(view, R.id.watchlist_box);
final boolean supportsWatchList = cache.supportsWatchList();
layout.setVisibility(supportsWatchList ? View.VISIBLE : View.GONE);
if (!supportsWatchList) {
return;
}
- final Button buttonAdd = (Button) view.findViewById(R.id.add_to_watchlist);
- final Button buttonRemove = (Button) view.findViewById(R.id.remove_from_watchlist);
- final TextView text = (TextView) view.findViewById(R.id.watchlist_text);
+ final Button buttonAdd = ButterKnife.findById(view, R.id.add_to_watchlist);
+ final Button buttonRemove = ButterKnife.findById(view, R.id.remove_from_watchlist);
+ final TextView text = ButterKnife.findById(view, R.id.watchlist_text);
if (cache.isOnWatchlist() || cache.isOwner()) {
buttonAdd.setVisibility(View.GONE);
@@ -1288,15 +1289,15 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
* shows/hides buttons, sets text in watchlist box
*/
private void updateFavPointBox() {
- final LinearLayout layout = (LinearLayout) view.findViewById(R.id.favpoint_box);
+ final LinearLayout layout = ButterKnife.findById(view, R.id.favpoint_box);
final boolean supportsFavoritePoints = cache.supportsFavoritePoints();
layout.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE);
if (!supportsFavoritePoints || cache.isOwner() || !Settings.isGCPremiumMember()) {
return;
}
- final Button buttonAdd = (Button) view.findViewById(R.id.add_to_favpoint);
- final Button buttonRemove = (Button) view.findViewById(R.id.remove_from_favpoint);
- final TextView text = (TextView) view.findViewById(R.id.favpoint_text);
+ final Button buttonAdd = ButterKnife.findById(view, R.id.add_to_favpoint);
+ final Button buttonRemove = ButterKnife.findById(view, R.id.remove_from_favpoint);
+ final TextView text = ButterKnife.findById(view, R.id.favpoint_text);
if (cache.isFavorite()) {
buttonAdd.setVisibility(View.GONE);
@@ -1328,7 +1329,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
box.setVisibility(View.VISIBLE);
// update text
- final TextView text = (TextView) view.findViewById(R.id.list_text);
+ final TextView text = ButterKnife.findById(view, R.id.list_text);
final StoredList list = DataStore.getList(cache.getListId());
if (list != null) {
text.setText(res.getString(R.string.cache_list_text) + " " + list.title);
@@ -1411,7 +1412,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
setPersonalNote(personalNoteView, cache.getPersonalNote());
personalNoteView.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
addContextMenu(personalNoteView);
- final Button personalNoteEdit = (Button) view.findViewById(R.id.edit_personalnote);
+ final Button personalNoteEdit = ButterKnife.findById(view, R.id.edit_personalnote);
personalNoteEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
@@ -1419,7 +1420,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
editPersonalNote(cache, CacheDetailActivity.this);
}
});
- final Button personalNoteUpload = (Button) view.findViewById(R.id.upload_personalnote);
+ final Button personalNoteUpload = ButterKnife.findById(view, R.id.upload_personalnote);
if (cache.isOffline() && ConnectorFactory.getConnector(cache).supportsPersonalNote()) {
personalNoteUpload.setVisibility(View.VISIBLE);
personalNoteUpload.setOnClickListener(new View.OnClickListener() {
@@ -1444,7 +1445,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
hintBoxView.setVisibility(View.GONE);
}
- final TextView hintView = ((TextView) view.findViewById(R.id.hint));
+ final TextView hintView = (ButterKnife.findById(view, R.id.hint));
if (StringUtils.isNotBlank(cache.getHint())) {
if (TextUtils.containsHtml(cache.getHint())) {
hintView.setText(Html.fromHtml(cache.getHint(), new HtmlImage(cache.getGeocode(), false, cache.getListId(), false), null), TextView.BufferType.SPANNABLE);
@@ -1467,7 +1468,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
hintBoxView.setOnClickListener(null);
}
- final TextView spoilerlinkView = ((TextView) view.findViewById(R.id.hint_spoilerlink));
+ final TextView spoilerlinkView = (ButterKnife.findById(view, R.id.hint_spoilerlink));
if (CollectionUtils.isNotEmpty(cache.getSpoilers())) {
spoilerlinkView.setVisibility(View.VISIBLE);
spoilerlinkView.setClickable(true);
@@ -2185,9 +2186,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
final OnClickListener dropCacheClickListener,
final OnClickListener storeCacheClickListener) {
// offline use
- final TextView offlineText = (TextView) view.findViewById(R.id.offline_text);
- final Button offlineRefresh = (Button) view.findViewById(R.id.offline_refresh);
- final Button offlineStore = (Button) view.findViewById(R.id.offline_store);
+ final TextView offlineText = ButterKnife.findById(view, R.id.offline_text);
+ final Button offlineRefresh = ButterKnife.findById(view, R.id.offline_refresh);
+ final Button offlineStore = ButterKnife.findById(view, R.id.offline_store);
if (cache.isOffline()) {
final long diff = (System.currentTimeMillis() / (60 * 1000)) - (cache.getDetailedUpdate() / (60 * 1000)); // minutes
@@ -2311,7 +2312,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
public void onFinishEditNoteDialog(final String note) {
cache.setPersonalNote(note);
cache.parseWaypointsFromNote();
- final TextView personalNoteView = (TextView) activity.findViewById(R.id.personalnote);
+ final TextView personalNoteView = ButterKnife.findById(activity, R.id.personalnote);
setPersonalNote(personalNoteView, note);
DataStore.saveCache(cache, EnumSet.of(SaveFlag.DB));
activity.notifyDataSetChanged();
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index 2191e0e..8c77891 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -1,5 +1,7 @@
package cgeo.geocaching;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.activity.AbstractListActivity;
import cgeo.geocaching.activity.ActivityMixin;
@@ -964,7 +966,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
listFooter = getLayoutInflater().inflate(R.layout.cacheslist_footer, listView, false);
listFooter.setClickable(true);
listFooter.setOnClickListener(new MoreCachesListener());
- listFooterText = (TextView) listFooter.findViewById(R.id.more_caches);
+ listFooterText = ButterKnife.findById(listFooter, R.id.more_caches);
listView.addFooterView(listFooter);
}
setListAdapter(adapter);
diff --git a/main/src/cgeo/geocaching/CgeoApplication.java b/main/src/cgeo/geocaching/CgeoApplication.java
index f819fa6..f5a5ec0 100644
--- a/main/src/cgeo/geocaching/CgeoApplication.java
+++ b/main/src/cgeo/geocaching/CgeoApplication.java
@@ -57,13 +57,12 @@ public class CgeoApplication extends Application {
try {
final ViewConfiguration config = ViewConfiguration.get(this);
final Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
-
- if (menuKeyField != null) {
- menuKeyField.setAccessible(true);
- menuKeyField.setBoolean(config, false);
- }
- } catch (final Exception ex) {
- // Ignore
+ menuKeyField.setAccessible(true);
+ menuKeyField.setBoolean(config, false);
+ } catch (final ReflectiveOperationException ex) {
+ // ignore
+ } catch (final IllegalArgumentException e) {
+ // ignore
}
}
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index 1ae27a3..d64301b 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -1,5 +1,7 @@
package cgeo.geocaching;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.connector.ILoggingManager;
import cgeo.geocaching.connector.ImageResult;
import cgeo.geocaching.connector.LogResult;
@@ -70,7 +72,6 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
private CheckBox tweetCheck = null;
private LinearLayout tweetBox = null;
private LinearLayout logPasswordBox = null;
- private boolean tbChanged = false;
private SparseArray<TrackableLog> actionButtons;
private ILoggingManager loggingManager;
@@ -124,7 +125,6 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
if (Settings.isTrackableAutoVisit()) {
for (final TrackableLog trackable : trackables) {
trackable.action = LogTypeTrackable.VISITED;
- tbChanged = true;
}
}
}
@@ -144,9 +144,11 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
for (final TrackableLog tb : trackables) {
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);
- final TextView actionButton = (TextView) inventoryItem.findViewById(R.id.action);
+ final TextView codeView = ButterKnife.findById(inventoryItem, R.id.trackcode);
+ codeView.setText(tb.trackCode);
+ final TextView nameView = ButterKnife.findById(inventoryItem, R.id.name);
+ nameView.setText(tb.name);
+ final TextView actionButton = ButterKnife.findById(inventoryItem, R.id.action);
actionButton.setId(tb.id);
actionButtons.put(actionButton.getId(), tb);
actionButton.setText(tb.action.getLabel() + " ▼");
@@ -179,7 +181,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
if (inventoryView.getChildCount() > 1) {
final LinearLayout inventoryChangeAllView = (LinearLayout) findViewById(R.id.inventory_changeall);
- final Button changeButton = (Button) inventoryChangeAllView.findViewById(R.id.changebutton);
+ final Button changeButton = ButterKnife.findById(inventoryChangeAllView, R.id.changebutton);
changeButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -374,12 +376,6 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
typeSelected = type;
typeButton.setText(typeSelected.getL10n());
- if (LogType.FOUND_IT == type && !tbChanged) {
- // TODO: change action
- } else if (LogType.FOUND_IT != type && !tbChanged) {
- // TODO: change action
- }
-
updateTweetBox(type);
updateLogPasswordBox(type);
}
@@ -522,7 +518,6 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
for (final TrackableLog tb : trackables) {
tb.action = logType;
}
- tbChanged = true;
updateTrackablesList();
dialog.dismiss();
}
@@ -570,7 +565,6 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
@Override
public void onClick(final DialogInterface dialog, final int position) {
final LogTypeTrackable logType = LogTypeTrackable.values()[position];
- tbChanged = true;
trackableLog.action = logType;
Log.i("Trackable " + trackableLog.trackCode + " (" + trackableLog.name + ") has new action: #" + logType);
updateTrackablesList();
diff --git a/main/src/cgeo/geocaching/StatusFragment.java b/main/src/cgeo/geocaching/StatusFragment.java
index 553acc1..a228363 100644
--- a/main/src/cgeo/geocaching/StatusFragment.java
+++ b/main/src/cgeo/geocaching/StatusFragment.java
@@ -1,5 +1,7 @@
package cgeo.geocaching;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.network.StatusUpdater;
import cgeo.geocaching.network.StatusUpdater.Status;
import cgeo.geocaching.utils.Log;
@@ -8,6 +10,7 @@ import rx.Subscription;
import rx.android.observables.AndroidObservable;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
+import rx.subscriptions.Subscriptions;
import android.content.Intent;
import android.content.res.Resources;
@@ -23,14 +26,14 @@ import android.widget.TextView;
public class StatusFragment extends Fragment {
- private Subscription statusSubscription;
+ private Subscription statusSubscription = Subscriptions.empty();
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
final ViewGroup statusGroup = (ViewGroup) inflater.inflate(R.layout.status, container, false);
- final ImageView statusIcon = (ImageView) statusGroup.findViewById(R.id.status_icon);
- final TextView statusMessage = (TextView) statusGroup.findViewById(R.id.status_message);
+ final ImageView statusIcon = ButterKnife.findById(statusGroup, R.id.status_icon);
+ final TextView statusMessage = ButterKnife.findById(statusGroup, R.id.status_message);
statusSubscription = AndroidObservable.bindFragment(this, StatusUpdater.latestStatus).subscribeOn(Schedulers.io())
.subscribe(new Action1<Status>() {
@Override
diff --git a/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java b/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java
index 1c6f5e0..6095514 100644
--- a/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java
+++ b/main/src/cgeo/geocaching/connector/gc/RecaptchaHandler.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.connector.gc;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import cgeo.geocaching.loaders.RecaptchaReceiver;
import cgeo.geocaching.network.Network;
@@ -80,9 +82,9 @@ public class RecaptchaHandler extends Handler {
final AlertDialog.Builder dlg = new AlertDialog.Builder(activity);
final View view = activity.getLayoutInflater().inflate(R.layout.recaptcha_dialog, null, false);
- final ImageView imageView = (ImageView) view.findViewById(R.id.image);
+ final ImageView imageView = ButterKnife.findById(view, R.id.image);
- final ImageButton reloadButton = (ImageButton) view.findViewById(R.id.button_recaptcha_refresh);
+ final ImageButton reloadButton = ButterKnife.findById(view, R.id.button_recaptcha_refresh);
reloadButton.setEnabled(false);
reloadButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -99,7 +101,8 @@ public class RecaptchaHandler extends Handler {
dlg.setNeutralButton(activity.getString(R.string.caches_recaptcha_continue), new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int id) {
- final String text = ((EditText) view.findViewById(R.id.text)).getText().toString();
+ final EditText editText = ButterKnife.findById(view, R.id.text);
+ final String text = editText.getText().toString();
recaptchaReceiver.setText(text);
dialog.cancel();
}
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index dd3c8a1..04c9dac 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.export;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
@@ -57,9 +59,9 @@ public class FieldnoteExport extends AbstractExport {
final View layout = View.inflate(new ContextThemeWrapper(activity, R.style.dark), R.layout.fieldnote_export_dialog, null);
builder.setView(layout);
- final CheckBox uploadOption = (CheckBox) layout.findViewById(R.id.upload);
+ final CheckBox uploadOption = ButterKnife.findById(layout, R.id.upload);
uploadOption.setChecked(Settings.getFieldNoteExportUpload());
- final CheckBox onlyNewOption = (CheckBox) layout.findViewById(R.id.onlynew);
+ final CheckBox onlyNewOption = ButterKnife.findById(layout, R.id.onlynew);
onlyNewOption.setChecked(Settings.getFieldNoteExportOnlyNew());
if (Settings.getFieldnoteExportDate() > 0) {
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 5ca5179..5a95128 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.export;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
@@ -61,10 +63,10 @@ public class GpxExport extends AbstractExport {
final View layout = View.inflate(new ContextThemeWrapper(activity, R.style.dark), R.layout.gpx_export_dialog, null);
builder.setView(layout);
- final TextView text = (TextView) layout.findViewById(R.id.info);
+ final TextView text = ButterKnife.findById(layout, R.id.info);
text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir()));
- final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share);
+ final CheckBox shareOption = ButterKnife.findById(layout, R.id.share);
shareOption.setChecked(Settings.getShareAfterExport());
diff --git a/main/src/cgeo/geocaching/files/SimpleDirChooser.java b/main/src/cgeo/geocaching/files/SimpleDirChooser.java
index 1e1296a..009c18a 100644
--- a/main/src/cgeo/geocaching/files/SimpleDirChooser.java
+++ b/main/src/cgeo/geocaching/files/SimpleDirChooser.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.files;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.Intents;
import cgeo.geocaching.R;
import cgeo.geocaching.activity.AbstractListActivity;
@@ -45,7 +47,7 @@ public class SimpleDirChooser extends AbstractListActivity {
private boolean chooseForWriting = false;
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Bundle extras = getIntent().getExtras();
currentDir = dirContaining(extras.getString(Intents.EXTRA_START_DIR));
@@ -60,27 +62,27 @@ public class SimpleDirChooser extends AbstractListActivity {
resetOkButton();
okButton.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(final View v) {
setResult(RESULT_OK, new Intent()
.setData(Uri.fromFile(new File(currentDir, adapter.getItem(lastPosition).getName()))));
finish();
}
});
- Button cancelButton = (Button) findViewById(R.id.simple_dir_chooser_cancel);
+ final Button cancelButton = (Button) findViewById(R.id.simple_dir_chooser_cancel);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
- Intent intent = new Intent();
+ public void onClick(final View v) {
+ final Intent intent = new Intent();
setResult(RESULT_CANCELED, intent);
finish();
}
});
- EditText pathField = (EditText) findViewById(R.id.simple_dir_chooser_path);
+ final EditText pathField = (EditText) findViewById(R.id.simple_dir_chooser_path);
pathField.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View v) {
+ public void onClick(final View v) {
editPath();
}
@@ -88,7 +90,7 @@ public class SimpleDirChooser extends AbstractListActivity {
}
public void editPath() {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.simple_dir_chooser_current_path);
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT);
@@ -96,9 +98,9 @@ public class SimpleDirChooser extends AbstractListActivity {
builder.setView(input);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int which) {
- String pathText = input.getText().toString();
- File newPathDir = new File(pathText);
+ public void onClick(final DialogInterface dialog, final int which) {
+ final String pathText = input.getText().toString();
+ final File newPathDir = new File(pathText);
if (newPathDir.exists() && newPathDir.isDirectory()) {
currentDir = newPathDir;
fill(currentDir);
@@ -109,7 +111,7 @@ public class SimpleDirChooser extends AbstractListActivity {
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int which) {
+ public void onClick(final DialogInterface dialog, final int which) {
dialog.cancel();
}
});
@@ -129,18 +131,18 @@ public class SimpleDirChooser extends AbstractListActivity {
Environment.getExternalStorageDirectory();
}
- private void fill(File dir) {
+ private void fill(final File dir) {
lastPosition = -1;
resetOkButton();
- EditText path = (EditText) findViewById(R.id.simple_dir_chooser_path);
+ final EditText path = (EditText) findViewById(R.id.simple_dir_chooser_path);
path.setText(this.getResources().getString(R.string.simple_dir_chooser_current_path) + " " + dir.getAbsolutePath());
final File[] dirs = dir.listFiles(new DirOnlyFilenameFilter());
- List<Option> listDirs = new ArrayList<Option>();
+ final List<Option> listDirs = new ArrayList<Option>();
try {
- for (File currentDir : dirs) {
+ for (final File currentDir : dirs) {
listDirs.add(new Option(currentDir.getName(), currentDir.getAbsolutePath(), currentDir.canWrite()));
}
- } catch (RuntimeException e) {
+ } catch (final RuntimeException e) {
}
Collections.sort(listDirs, Option.NAME_COMPARATOR);
if (dir.getParent() != null) {
@@ -159,11 +161,11 @@ public class SimpleDirChooser extends AbstractListActivity {
public class FileArrayAdapter extends ArrayAdapter<Option> {
- private Context context;
- private int id;
- private List<Option> items;
+ private final Context context;
+ private final int id;
+ private final List<Option> items;
- public FileArrayAdapter(Context context, int simpleDirItemResId, List<Option> objects) {
+ public FileArrayAdapter(final Context context, final int simpleDirItemResId, final List<Option> objects) {
super(context, simpleDirItemResId, objects);
this.context = context;
this.id = simpleDirItemResId;
@@ -171,26 +173,26 @@ public class SimpleDirChooser extends AbstractListActivity {
}
@Override
- public Option getItem(int index) {
+ public Option getItem(final int index) {
return items.get(index);
}
@Override
- public View getView(int position, View convertView, ViewGroup parent) {
+ public View getView(final int position, final View convertView, final ViewGroup parent) {
View v = convertView;
if (v == null) {
- LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ final LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, null);
}
final Option option = items.get(position);
if (option != null) {
- TextView t1 = (TextView) v.findViewById(R.id.TextView01);
+ final TextView t1 = ButterKnife.findById(v, R.id.TextView01);
if (t1 != null) {
t1.setOnClickListener(new OnTextViewClickListener(position));
t1.setText(option.getName());
}
- CheckBox check = (CheckBox) v.findViewById(R.id.CheckBox);
+ final CheckBox check = ButterKnife.findById(v, R.id.CheckBox);
if (check != null) {
if (!chooseForWriting || option.isWriteable()) {
check.setOnClickListener(new OnCheckBoxClickListener(position));
@@ -206,20 +208,20 @@ public class SimpleDirChooser extends AbstractListActivity {
}
public class OnTextViewClickListener implements OnClickListener {
- private int position;
+ private final int position;
- OnTextViewClickListener(int position) {
+ OnTextViewClickListener(final int position) {
this.position = position;
}
@Override
- public void onClick(View arg0) {
- Option option = adapter.getItem(position);
+ public void onClick(final View arg0) {
+ final Option option = adapter.getItem(position);
if (option.getName().equals(PARENT_DIR)) {
currentDir = new File(option.getPath());
fill(currentDir);
} else {
- File dir = new File(option.getPath());
+ final File dir = new File(option.getPath());
if (dir.list(new DirOnlyFilenameFilter()).length > 0) {
currentDir = dir;
fill(currentDir);
@@ -229,16 +231,16 @@ public class SimpleDirChooser extends AbstractListActivity {
}
public class OnCheckBoxClickListener implements OnClickListener {
- private int position;
+ private final int position;
- OnCheckBoxClickListener(int position) {
+ OnCheckBoxClickListener(final int position) {
this.position = position;
}
@Override
- public void onClick(View arg0) {
- Option lastOption = (lastPosition > -1) ? adapter.getItem(lastPosition) : null;
- Option currentOption = adapter.getItem(position);
+ public void onClick(final View arg0) {
+ final Option lastOption = (lastPosition > -1) ? adapter.getItem(lastPosition) : null;
+ final Option currentOption = adapter.getItem(position);
if (lastOption != null) {
lastOption.setChecked(false);
}
@@ -264,13 +266,13 @@ public class SimpleDirChooser extends AbstractListActivity {
private static Comparator<Option> NAME_COMPARATOR = new Comparator<SimpleDirChooser.Option>() {
@Override
- public int compare(Option lhs, Option rhs) {
+ public int compare(final Option lhs, final Option rhs) {
return String.CASE_INSENSITIVE_ORDER.compare(lhs.name, rhs.name);
}
};
- public Option(String name, String path, boolean writeable) {
+ public Option(final String name, final String path, final boolean writeable) {
this.name = name;
this.path = path;
this.writeable = writeable;
@@ -288,7 +290,7 @@ public class SimpleDirChooser extends AbstractListActivity {
return this.checked;
}
- public void setChecked(boolean checked) {
+ public void setChecked(final boolean checked) {
this.checked = checked;
}
@@ -300,8 +302,8 @@ public class SimpleDirChooser extends AbstractListActivity {
public static class DirOnlyFilenameFilter implements FilenameFilter {
@Override
- public boolean accept(File dir, String filename) {
- File file = new File(dir, filename);
+ public boolean accept(final File dir, final String filename) {
+ final File file = new File(dir, filename);
return file.isDirectory() && file.canRead();
}
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index c3ca207..fc94ad4 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.maps;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.CacheListActivity;
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.DataStore;
@@ -49,7 +51,6 @@ import rx.Subscription;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
-import rx.subscriptions.CompositeSubscription;
import rx.subscriptions.Subscriptions;
import android.annotation.TargetApi;
@@ -101,7 +102,10 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
/** max. number of caches displayed in the Live Map */
public static final int MAX_CACHES = 500;
- private CompositeSubscription resumeSubscription;
+ /**
+ * initialization with an empty subscription to make static code analysis tools more happy
+ */
+ private Subscription resumeSubscription = Subscriptions.empty();
/** Controls the behavior of the map */
public enum MapMode {
@@ -271,7 +275,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
private void setTitle(final String title) {
/* Compatibility for the old Action Bar, only used by the maps activity at the moment */
- final TextView titleview = (TextView) activity.findViewById(R.id.actionbar_title);
+ final TextView titleview = ButterKnife.findById(activity, R.id.actionbar_title);
if (titleview != null) {
titleview.setText(title);
@@ -529,7 +533,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
}
- final CheckBox locSwitch = (CheckBox) activity.findViewById(R.id.my_position);
+ final CheckBox locSwitch = ButterKnife.findById(activity, R.id.my_position);
if (locSwitch!=null) {
initMyLocationSwitchButton(locSwitch);
}
@@ -563,7 +567,8 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
// show the filter warning bar if the filter is set
if (Settings.getCacheType() != CacheType.ALL) {
final String cacheType = Settings.getCacheType().getL10n();
- ((TextView) activity.findViewById(R.id.filter_text)).setText(cacheType);
+ final TextView filterTitleView = ButterKnife.findById(activity, R.id.filter_text);
+ filterTitleView.setText(cacheType);
activity.findViewById(R.id.filter_bar).setVisibility(View.VISIBLE);
} else {
activity.findViewById(R.id.filter_bar).setVisibility(View.GONE);
diff --git a/main/src/cgeo/geocaching/settings/TemplateTextPreference.java b/main/src/cgeo/geocaching/settings/TemplateTextPreference.java
index 1f420ef..a33f09d 100644
--- a/main/src/cgeo/geocaching/settings/TemplateTextPreference.java
+++ b/main/src/cgeo/geocaching/settings/TemplateTextPreference.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.settings;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.ui.dialog.Dialogs;
@@ -30,12 +32,12 @@ public class TemplateTextPreference extends DialogPreference {
private EditText editText;
private String initialValue;
- public TemplateTextPreference(Context context, AttributeSet attrs) {
+ public TemplateTextPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
init();
}
- public TemplateTextPreference(Context context, AttributeSet attrs, int defStyle) {
+ public TemplateTextPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
init();
}
@@ -45,28 +47,28 @@ public class TemplateTextPreference extends DialogPreference {
}
@Override
- protected void onBindDialogView(View view) {
+ protected void onBindDialogView(final View view) {
settingsActivity = (SettingsActivity) this.getContext();
- editText = (EditText) view.findViewById(R.id.signature_dialog_text);
+ editText = ButterKnife.findById(view, R.id.signature_dialog_text);
editText.setText(getPersistedString(initialValue != null ? initialValue : StringUtils.EMPTY));
Dialogs.moveCursorToEnd(editText);
- Button button = (Button) view.findViewById(R.id.signature_templates);
+ final Button button = ButterKnife.findById(view, R.id.signature_templates);
button.setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View button) {
- AlertDialog.Builder alert = new AlertDialog.Builder(TemplateTextPreference.this.getContext());
+ public void onClick(final View button) {
+ final AlertDialog.Builder alert = new AlertDialog.Builder(TemplateTextPreference.this.getContext());
alert.setTitle(R.string.init_signature_template_button);
final ArrayList<LogTemplate> templates = LogTemplateProvider.getTemplatesWithoutSignature();
- String[] items = new String[templates.size()];
+ final String[] items = new String[templates.size()];
for (int i = 0; i < templates.size(); i++) {
items[i] = settingsActivity.getResources().getString(templates.get(i).getResourceId());
}
alert.setItems(items, new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int position) {
+ public void onClick(final DialogInterface dialog, final int position) {
dialog.dismiss();
final LogTemplate template = templates.get(position);
insertSignatureTemplate(template);
@@ -80,14 +82,14 @@ public class TemplateTextPreference extends DialogPreference {
}
private void insertSignatureTemplate(final LogTemplate template) {
- String insertText = "[" + template.getTemplateString() + "]";
+ final String insertText = "[" + template.getTemplateString() + "]";
ActivityMixin.insertAtPosition(editText, insertText, true);
}
@Override
- protected void onDialogClosed(boolean positiveResult) {
+ protected void onDialogClosed(final boolean positiveResult) {
if (positiveResult) {
- String text = editText.getText().toString();
+ final String text = editText.getText().toString();
persistString(text);
callChangeListener(text);
}
@@ -95,7 +97,7 @@ public class TemplateTextPreference extends DialogPreference {
}
@Override
- protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
+ protected void onSetInitialValue(final boolean restorePersistedValue, final Object defaultValue) {
if (restorePersistedValue) {
// Restore existing state
initialValue = this.getPersistedString(DEFAULT_VALUE);
@@ -107,7 +109,7 @@ public class TemplateTextPreference extends DialogPreference {
}
@Override
- protected Object onGetDefaultValue(TypedArray array, int index) {
+ protected Object onGetDefaultValue(final TypedArray array, final int index) {
return array.getString(index);
}
}
diff --git a/main/src/cgeo/geocaching/settings/TextPreference.java b/main/src/cgeo/geocaching/settings/TextPreference.java
index eecf4cc..b3de59a 100644
--- a/main/src/cgeo/geocaching/settings/TextPreference.java
+++ b/main/src/cgeo/geocaching/settings/TextPreference.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.settings;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import android.content.Context;
@@ -29,15 +31,15 @@ public class TextPreference extends AbstractAttributeBasedPrefence {
private TextView summaryView;
private CharSequence summaryText;
- public TextPreference(Context context) {
+ public TextPreference(final Context context) {
super(context);
}
- public TextPreference(Context context, AttributeSet attrs) {
+ public TextPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
- public TextPreference(Context context, AttributeSet attrs, int defStyle) {
+ public TextPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@@ -47,27 +49,27 @@ public class TextPreference extends AbstractAttributeBasedPrefence {
}
@Override
- protected void processAttributeValues(TypedArray values) {
+ protected void processAttributeValues(final TypedArray values) {
this.text = values.getString(0);
}
@Override
- protected View onCreateView(ViewGroup parent) {
+ protected View onCreateView(final ViewGroup parent) {
this.setSelectable(false);
- View v = super.onCreateView(parent);
+ final View v = super.onCreateView(parent);
- TextView text = (TextView) v.findViewById(R.id.textPreferenceText);
+ final TextView text = ButterKnife.findById(v, R.id.textPreferenceText);
text.setText(this.text);
- summaryView = (TextView) v.findViewById(R.id.textPreferenceSummary);
+ summaryView = ButterKnife.findById(v, R.id.textPreferenceSummary);
setSummary(null); // show saved summary text
return v;
}
@Override
- public void setSummary(CharSequence summaryText) {
+ public void setSummary(final CharSequence summaryText) {
// the layout hasn't been inflated yet, save the summaryText for later use
if (summaryView == null) {
this.summaryText = summaryText;
diff --git a/main/src/cgeo/geocaching/settings/WpThresholdPreference.java b/main/src/cgeo/geocaching/settings/WpThresholdPreference.java
index 4c43acf..37edafa 100644
--- a/main/src/cgeo/geocaching/settings/WpThresholdPreference.java
+++ b/main/src/cgeo/geocaching/settings/WpThresholdPreference.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.settings;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import android.content.Context;
@@ -15,17 +17,17 @@ public class WpThresholdPreference extends Preference {
private TextView valueView;
- public WpThresholdPreference(Context context) {
+ public WpThresholdPreference(final Context context) {
super(context);
init();
}
- public WpThresholdPreference(Context context, AttributeSet attrs) {
+ public WpThresholdPreference(final Context context, final AttributeSet attrs) {
super(context, attrs);
init();
}
- public WpThresholdPreference(Context context, AttributeSet attrs, int defStyle) {
+ public WpThresholdPreference(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
init();
}
@@ -35,33 +37,33 @@ public class WpThresholdPreference extends Preference {
}
@Override
- protected View onCreateView(ViewGroup parent) {
- View v = super.onCreateView(parent);
+ protected View onCreateView(final ViewGroup parent) {
+ final View v = super.onCreateView(parent);
// get views
- SeekBar seekBar = (SeekBar) v.findViewById(R.id.wp_threshold_seekbar);
- valueView = (TextView) v.findViewById(R.id.wp_threshold_value_view);
+ final SeekBar seekBar = ButterKnife.findById(v, R.id.wp_threshold_seekbar);
+ valueView = ButterKnife.findById(v, R.id.wp_threshold_value_view);
// init seekbar
seekBar.setMax(Settings.SHOW_WP_THRESHOLD_MAX);
// set initial value
- int threshold = Settings.getWayPointsThreshold();
+ final int threshold = Settings.getWayPointsThreshold();
valueView.setText(String.valueOf(threshold));
seekBar.setProgress(threshold);
seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
if (fromUser) {
valueView.setText(String.valueOf(progress));
}
}
@Override
- public void onStartTrackingTouch(SeekBar seekBar) {
+ public void onStartTrackingTouch(final SeekBar seekBar) {
}
@Override
- public void onStopTrackingTouch(SeekBar seekBar) {
+ public void onStopTrackingTouch(final SeekBar seekBar) {
Settings.setShowWaypointsThreshold(seekBar.getProgress());
}
});
diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
index e4b5f54..afd3666 100644
--- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
+++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.ui;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
@@ -50,9 +52,9 @@ public final class CacheDetailsCreator {
*/
public TextView add(final int nameId, final CharSequence value) {
final RelativeLayout layout = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.cache_information_item, null, false);
- final TextView nameView = (TextView) layout.findViewById(R.id.name);
+ final TextView nameView = ButterKnife.findById(layout, R.id.name);
nameView.setText(res.getString(nameId));
- lastValueView = (TextView) layout.findViewById(R.id.value);
+ lastValueView = ButterKnife.findById(layout, R.id.value);
lastValueView.setText(value);
parentView.addView(layout);
return lastValueView;
@@ -68,9 +70,9 @@ 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, 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);
+ final TextView nameView = ButterKnife.findById(layout, R.id.name);
+ lastValueView = ButterKnife.findById(layout, R.id.value);
+ final LinearLayout layoutStars = ButterKnife.findById(layout, R.id.stars);
nameView.setText(activity.getResources().getString(nameId));
lastValueView.setText(String.format("%.1f", value) + ' ' + activity.getResources().getString(R.string.cache_rating_of) + " " + String.format("%d", max));
@@ -123,7 +125,7 @@ public final class CacheDetailsCreator {
if (cache.getRating() > 0) {
final RelativeLayout itemLayout = addStars(R.string.cache_rating, cache.getRating());
if (cache.getVotes() > 0) {
- final TextView itemAddition = (TextView) itemLayout.findViewById(R.id.addition);
+ final TextView itemAddition = ButterKnife.findById(itemLayout, R.id.addition);
itemAddition.setText("(" + cache.getVotes() + ")");
itemAddition.setVisibility(View.VISIBLE);
}
diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java
index 60982a9..b503d6c 100644
--- a/main/src/cgeo/geocaching/ui/CompassView.java
+++ b/main/src/cgeo/geocaching/ui/CompassView.java
@@ -6,6 +6,7 @@ import cgeo.geocaching.utils.AngleUtils;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action0;
+import rx.subscriptions.Subscriptions;
import android.content.Context;
import android.content.res.Resources;
@@ -54,13 +55,13 @@ public class CompassView extends View {
private int compassOverlayWidth = 0;
private int compassOverlayHeight = 0;
private boolean initialDisplay;
- private Subscription periodicUpdate;
+ private Subscription periodicUpdate = Subscriptions.empty();
private static final class UpdateAction implements Action0 {
private final WeakReference<CompassView> compassViewRef;
- private UpdateAction(CompassView view) {
+ private UpdateAction(final CompassView view) {
this.compassViewRef = new WeakReference<CompassView>(view);
}
@@ -74,7 +75,7 @@ public class CompassView extends View {
}
}
- public CompassView(Context contextIn) {
+ public CompassView(final Context contextIn) {
super(contextIn);
context = contextIn;
}
@@ -90,7 +91,7 @@ public class CompassView extends View {
}
}
- public CompassView(Context contextIn, AttributeSet attrs) {
+ public CompassView(final Context contextIn, final AttributeSet attrs) {
super(contextIn, attrs);
context = contextIn;
}
@@ -174,7 +175,7 @@ public class CompassView extends View {
* the actual value
* @return the new value
*/
- static protected float smoothUpdate(float goal, float actual) {
+ static protected float smoothUpdate(final float goal, final float actual) {
final double diff = AngleUtils.difference(actual, goal);
double offset = 0;
@@ -191,7 +192,7 @@ public class CompassView extends View {
}
@Override
- protected void onDraw(Canvas canvas) {
+ protected void onDraw(final Canvas canvas) {
final float azimuthTemp = azimuthShown;
final float azimuthRelative = AngleUtils.normalize(azimuthTemp - cacheHeadingShown);
@@ -236,11 +237,11 @@ public class CompassView extends View {
}
@Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
}
- private int measureWidth(int measureSpec) {
+ private int measureWidth(final int measureSpec) {
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
@@ -256,7 +257,7 @@ public class CompassView extends View {
return desired;
}
- private int measureHeight(int measureSpec) {
+ private int measureHeight(final int measureSpec) {
// The duplicated code in measureHeight and measureWidth cannot be avoided.
// Those methods must be efficient, therefore we cannot extract the code differences and unify the remainder.
final int specMode = MeasureSpec.getMode(measureSpec);
diff --git a/main/src/cgeo/geocaching/ui/EditNoteDialog.java b/main/src/cgeo/geocaching/ui/EditNoteDialog.java
index 63f06fc..cb1b11d 100644
--- a/main/src/cgeo/geocaching/ui/EditNoteDialog.java
+++ b/main/src/cgeo/geocaching/ui/EditNoteDialog.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.ui;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import cgeo.geocaching.activity.Keyboard;
import cgeo.geocaching.ui.dialog.Dialogs;
@@ -27,10 +29,10 @@ public class EditNoteDialog extends DialogFragment {
private EditText mEditText;
private EditNoteDialogListener listener;
- public static EditNoteDialog newInstance(final String initialNote, EditNoteDialogListener listener) {
- EditNoteDialog dialog = new EditNoteDialog();
+ public static EditNoteDialog newInstance(final String initialNote, final EditNoteDialogListener listener) {
+ final EditNoteDialog dialog = new EditNoteDialog();
- Bundle arguments = new Bundle();
+ final Bundle arguments = new Bundle();
arguments.putString(EditNoteDialog.ARGUMENT_INITIAL_NOTE, initialNote);
dialog.setArguments(arguments);
dialog.listener = listener;
@@ -39,24 +41,24 @@ public class EditNoteDialog extends DialogFragment {
}
@Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
+ public Dialog onCreateDialog(final Bundle savedInstanceState) {
final @NonNull FragmentActivity activity = getActivity();
- View view = View.inflate(new ContextThemeWrapper(activity, R.style.dark), R.layout.fragment_edit_note, null);
- mEditText = (EditText) view.findViewById(R.id.note);
- String initialNote = getArguments().getString(ARGUMENT_INITIAL_NOTE);
+ final View view = View.inflate(new ContextThemeWrapper(activity, R.style.dark), R.layout.fragment_edit_note, null);
+ mEditText = ButterKnife.findById(view, R.id.note);
+ final String initialNote = getArguments().getString(ARGUMENT_INITIAL_NOTE);
if (initialNote != null) {
mEditText.setText(initialNote);
Dialogs.moveCursorToEnd(mEditText);
getArguments().remove(ARGUMENT_INITIAL_NOTE);
}
- AlertDialog.Builder builder = new AlertDialog.Builder(activity);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.cache_personal_note);
builder.setView(view);
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int whichButton) {
+ public void onClick(final DialogInterface dialog, final int whichButton) {
listener.onFinishEditNoteDialog(mEditText.getText().toString());
dialog.dismiss();
}
@@ -64,7 +66,7 @@ public class EditNoteDialog extends DialogFragment {
builder.setNegativeButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int whichButton) {
+ public void onClick(final DialogInterface dialog, final int whichButton) {
dialog.dismiss();
}
});
diff --git a/main/src/cgeo/geocaching/ui/ImagesList.java b/main/src/cgeo/geocaching/ui/ImagesList.java
index bf53725..fbf6f8b 100644
--- a/main/src/cgeo/geocaching/ui/ImagesList.java
+++ b/main/src/cgeo/geocaching/ui/ImagesList.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.ui;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.Image;
import cgeo.geocaching.R;
import cgeo.geocaching.files.LocalStorage;
@@ -98,7 +100,7 @@ public class ImagesList {
}
}));
- imagesView = (LinearLayout) parentView.findViewById(R.id.spoiler_list);
+ imagesView = ButterKnife.findById(parentView, R.id.spoiler_list);
final HtmlImage imgGetter = new HtmlImage(geocode, true, offline ? StoredList.STANDARD_LIST_ID : StoredList.TEMPORARY_LIST_ID, false);
@@ -107,12 +109,13 @@ public class ImagesList {
assert(rowView != null);
if (StringUtils.isNotBlank(img.getTitle())) {
- ((TextView) rowView.findViewById(R.id.title)).setText(Html.fromHtml(img.getTitle()));
+ final TextView titleView = ButterKnife.findById(rowView, R.id.title);
+ titleView.setText(Html.fromHtml(img.getTitle()));
rowView.findViewById(R.id.titleLayout).setVisibility(View.VISIBLE);
}
if (StringUtils.isNotBlank(img.getDescription())) {
- final TextView descView = (TextView) rowView.findViewById(R.id.description);
+ final TextView descView = ButterKnife.findById(rowView, R.id.description);
descView.setText(Html.fromHtml(img.getDescription()), TextView.BufferType.SPANNABLE);
descView.setVisibility(View.VISIBLE);
}
diff --git a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
index 06943f0..ca3e3a4 100644
--- a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
+++ b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.ui.dialog;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.activity.AbstractActivity;
@@ -103,7 +105,7 @@ public class CoordinatesInputDialog extends DialogFragment {
getDialog().setTitle(R.string.cache_coordinates);
final View v = inflater.inflate(R.layout.coordinatesinput_dialog, container, false);
- final Spinner spinner = (Spinner) v.findViewById(R.id.spinnerCoordinateFormats);
+ final Spinner spinner = ButterKnife.findById(v, R.id.spinnerCoordinateFormats);
final ArrayAdapter<CharSequence> adapter =
ArrayAdapter.createFromResource(getActivity(),
R.array.waypoint_coordinate_formats,
@@ -113,25 +115,25 @@ public class CoordinatesInputDialog extends DialogFragment {
spinner.setSelection(Settings.getCoordInputFormat().ordinal());
spinner.setOnItemSelectedListener(new CoordinateFormatListener());
- bLat = (Button) v.findViewById(R.id.ButtonLat);
- eLat = (EditText) v.findViewById(R.id.latitude);
- eLatDeg = (EditText) v.findViewById(R.id.EditTextLatDeg);
- eLatMin = (EditText) v.findViewById(R.id.EditTextLatMin);
- eLatSec = (EditText) v.findViewById(R.id.EditTextLatSec);
- eLatSub = (EditText) v.findViewById(R.id.EditTextLatSecFrac);
- tLatSep1 = (TextView) v.findViewById(R.id.LatSeparator1);
- tLatSep2 = (TextView) v.findViewById(R.id.LatSeparator2);
- tLatSep3 = (TextView) v.findViewById(R.id.LatSeparator3);
-
- bLon = (Button) v.findViewById(R.id.ButtonLon);
- eLon = (EditText) v.findViewById(R.id.longitude);
- eLonDeg = (EditText) v.findViewById(R.id.EditTextLonDeg);
- eLonMin = (EditText) v.findViewById(R.id.EditTextLonMin);
- eLonSec = (EditText) v.findViewById(R.id.EditTextLonSec);
- eLonSub = (EditText) v.findViewById(R.id.EditTextLonSecFrac);
- tLonSep1 = (TextView) v.findViewById(R.id.LonSeparator1);
- tLonSep2 = (TextView) v.findViewById(R.id.LonSeparator2);
- tLonSep3 = (TextView) v.findViewById(R.id.LonSeparator3);
+ bLat = ButterKnife.findById(v, R.id.ButtonLat);
+ eLat = ButterKnife.findById(v, R.id.latitude);
+ eLatDeg = ButterKnife.findById(v, R.id.EditTextLatDeg);
+ eLatMin = ButterKnife.findById(v, R.id.EditTextLatMin);
+ eLatSec = ButterKnife.findById(v, R.id.EditTextLatSec);
+ eLatSub = ButterKnife.findById(v, R.id.EditTextLatSecFrac);
+ tLatSep1 = ButterKnife.findById(v, R.id.LatSeparator1);
+ tLatSep2 = ButterKnife.findById(v, R.id.LatSeparator2);
+ tLatSep3 = ButterKnife.findById(v, R.id.LatSeparator3);
+
+ bLon = ButterKnife.findById(v, R.id.ButtonLon);
+ eLon = ButterKnife.findById(v, R.id.longitude);
+ eLonDeg = ButterKnife.findById(v, R.id.EditTextLonDeg);
+ eLonMin = ButterKnife.findById(v, R.id.EditTextLonMin);
+ eLonSec = ButterKnife.findById(v, R.id.EditTextLonSec);
+ eLonSub = ButterKnife.findById(v, R.id.EditTextLonSecFrac);
+ tLonSep1 = ButterKnife.findById(v, R.id.LonSeparator1);
+ tLonSep2 = ButterKnife.findById(v, R.id.LonSeparator2);
+ tLonSep3 = ButterKnife.findById(v, R.id.LonSeparator3);
eLatDeg.addTextChangedListener(new TextChanged(eLatDeg));
eLatMin.addTextChangedListener(new TextChanged(eLatMin));
@@ -154,9 +156,9 @@ public class CoordinatesInputDialog extends DialogFragment {
bLat.setOnClickListener(new ButtonClickListener());
bLon.setOnClickListener(new ButtonClickListener());
- final Button buttonCurrent = (Button) v.findViewById(R.id.current);
+ final Button buttonCurrent = ButterKnife.findById(v, R.id.current);
buttonCurrent.setOnClickListener(new CurrentListener());
- final Button buttonCache = (Button) v.findViewById(R.id.cache);
+ final Button buttonCache = ButterKnife.findById(v, R.id.cache);
if (cacheCoords != null) {
buttonCache.setOnClickListener(new CacheListener());
@@ -164,7 +166,7 @@ public class CoordinatesInputDialog extends DialogFragment {
buttonCache.setVisibility(View.GONE);
}
- final Button buttonDone = (Button) v.findViewById(R.id.done);
+ final Button buttonDone = ButterKnife.findById(v, R.id.done);
buttonDone.setOnClickListener(new InputDoneListener());
return v;
diff --git a/main/src/cgeo/geocaching/ui/dialog/CustomProgressDialog.java b/main/src/cgeo/geocaching/ui/dialog/CustomProgressDialog.java
index 97c5c29..74f568f 100644
--- a/main/src/cgeo/geocaching/ui/dialog/CustomProgressDialog.java
+++ b/main/src/cgeo/geocaching/ui/dialog/CustomProgressDialog.java
@@ -10,7 +10,6 @@ import android.view.View;
import android.widget.TextView;
import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
@@ -19,31 +18,27 @@ import java.lang.reflect.Method;
*/
public class CustomProgressDialog extends ProgressDialog {
- public CustomProgressDialog(Context context) {
+ public CustomProgressDialog(final Context context) {
super(context, ActivityMixin.getDialogTheme());
}
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
- Method method = TextView.class.getMethod("setVisibility", Integer.TYPE);
+ final Method method = TextView.class.getMethod("setVisibility", Integer.TYPE);
- Field[] fields = this.getClass().getSuperclass().getDeclaredFields();
+ final Field[] fields = this.getClass().getSuperclass().getDeclaredFields();
- for (Field field : fields) {
+ for (final Field field : fields) {
if (field.getName().equalsIgnoreCase("mProgressNumber")) {
field.setAccessible(true);
- TextView textView = (TextView) field.get(this);
+ final TextView textView = (TextView) field.get(this);
method.invoke(textView, View.GONE);
}
}
- } catch (NoSuchMethodException e) {
- Log.e("Failed to invoke the progressDialog method 'setVisibility' and set 'mProgressNumber' to GONE.", e);
- } catch (IllegalAccessException e) {
- Log.e("Failed to invoke the progressDialog method 'setVisibility' and set 'mProgressNumber' to GONE.", e);
- } catch (InvocationTargetException e) {
+ } catch (final ReflectiveOperationException e) {
Log.e("Failed to invoke the progressDialog method 'setVisibility' and set 'mProgressNumber' to GONE.", e);
}
}
diff --git a/main/src/cgeo/geocaching/ui/dialog/DateDialog.java b/main/src/cgeo/geocaching/ui/dialog/DateDialog.java
index fc69f44..1046f81 100644
--- a/main/src/cgeo/geocaching/ui/dialog/DateDialog.java
+++ b/main/src/cgeo/geocaching/ui/dialog/DateDialog.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.ui.dialog;
+import butterknife.ButterKnife;
+
import cgeo.geocaching.R;
import android.os.Bundle;
@@ -19,9 +21,9 @@ public class DateDialog extends DialogFragment {
private Calendar date;
- public static DateDialog getInstance(Calendar date) {
- DateDialog dd = new DateDialog();
- Bundle args = new Bundle();
+ public static DateDialog getInstance(final Calendar date) {
+ final DateDialog dd = new DateDialog();
+ final Bundle args = new Bundle();
args.putSerializable("date", date);
dd.setArguments(args);
return dd;
@@ -31,15 +33,15 @@ public class DateDialog extends DialogFragment {
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_TITLE, 0);
- Bundle args = getArguments();
+ final Bundle args = getArguments();
date = (Calendar) args.getSerializable("date");
}
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.date, container, false);
+ final View v = inflater.inflate(R.layout.date, container, false);
- final DatePicker picker = (DatePicker) v.findViewById(R.id.picker);
+ final DatePicker picker = ButterKnife.findById(v, R.id.picker);
picker.init(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DATE), new DatePickerListener());
return v;
}
@@ -47,7 +49,7 @@ public class DateDialog extends DialogFragment {
private class DatePickerListener implements DatePicker.OnDateChangedListener {
@Override
- public void onDateChanged(DatePicker picker, int year, int month, int day) {
+ public void onDateChanged(final DatePicker picker, final int year, final int month, final int day) {
date.set(year, month, day);
((DateDialogParent) getActivity()).setDate(date);