aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-06-01 15:25:55 +0200
committerBananeweizen <bananeweizen@gmx.de>2014-06-01 15:25:55 +0200
commit2ccec30e6d84950b2d0626994bcd74faebaf6634 (patch)
treeea6079df6a1e0b8d50d2e09a6633409af4ef3d0c
parentfc73a0edc9d7488660fdb34fefc9cc9f1c5a5d69 (diff)
downloadcgeo-2ccec30e6d84950b2d0626994bcd74faebaf6634.zip
cgeo-2ccec30e6d84950b2d0626994bcd74faebaf6634.tar.gz
cgeo-2ccec30e6d84950b2d0626994bcd74faebaf6634.tar.bz2
fix #3864: don't call search function on our own
This is already handled by the search configuration. We would only need to call this ourselfes if we had not registered such a search configuration.
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java53
1 files changed, 25 insertions, 28 deletions
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index cf323bb..2ed130f 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -91,24 +91,24 @@ public class MainActivity extends AbstractActionBarActivity {
private final UpdateLocation locationUpdater = new UpdateLocation();
- private Handler updateUserInfoHandler = new Handler() {
+ private final Handler updateUserInfoHandler = new Handler() {
@Override
public void handleMessage(final Message msg) {
// Get active connectors with login status
- ILogin[] loginConns = ConnectorFactory.getActiveLiveConnectors();
+ final ILogin[] loginConns = ConnectorFactory.getActiveLiveConnectors();
// Update UI
infoArea.removeAllViews();
- LayoutInflater inflater = getLayoutInflater();
+ final LayoutInflater inflater = getLayoutInflater();
- for (ILogin conn : loginConns) {
+ for (final ILogin conn : loginConns) {
- TextView connectorInfo = (TextView) inflater.inflate(R.layout.main_activity_connectorstatus, null);
+ final TextView connectorInfo = (TextView) inflater.inflate(R.layout.main_activity_connectorstatus, null);
infoArea.addView(connectorInfo);
- StringBuilder userInfo = new StringBuilder(conn.getName()).append(Formatter.SEPARATOR);
+ final StringBuilder userInfo = new StringBuilder(conn.getName()).append(Formatter.SEPARATOR);
if (conn.isLoggedIn()) {
userInfo.append(conn.getUserName());
if (conn.getCachesFound() >= 0) {
@@ -172,9 +172,9 @@ public class MainActivity extends AbstractActionBarActivity {
}
- private SatellitesHandler satellitesHandler = new SatellitesHandler();
+ private final SatellitesHandler satellitesHandler = new SatellitesHandler();
- private Handler firstLoginHandler = new Handler() {
+ private final Handler firstLoginHandler = new Handler() {
@Override
public void handleMessage(final Message msg) {
@@ -184,7 +184,7 @@ public class MainActivity extends AbstractActionBarActivity {
if (reason != null && reason != StatusCode.NO_ERROR) { //LoginFailed
showToast(res.getString(reason == StatusCode.MAINTENANCE ? reason.getErrorString() : R.string.err_login_failed_toast));
}
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.w("MainActivity.firstLoginHander", e);
}
}
@@ -273,9 +273,9 @@ public class MainActivity extends AbstractActionBarActivity {
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.main_activity_options, menu);
- SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
- MenuItem searchItem = menu.findItem(R.id.menu_gosearch);
- SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
+ final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+ final MenuItem searchItem = menu.findItem(R.id.menu_gosearch);
+ final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
return true;
@@ -323,15 +323,12 @@ public class MainActivity extends AbstractActionBarActivity {
}
});
return true;
- case R.id.menu_gosearch:
- onSearchRequested();
- return true;
}
return super.onOptionsItemSelected(item);
}
private void startScannerApplication() {
- IntentIntegrator integrator = new IntentIntegrator(this);
+ final IntentIntegrator integrator = new IntentIntegrator(this);
// integrator dialog is English only, therefore localize it
integrator.setButtonYesByID(android.R.string.yes);
integrator.setButtonNoByID(android.R.string.no);
@@ -342,9 +339,9 @@ public class MainActivity extends AbstractActionBarActivity {
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
- IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
+ final IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
- String scan = scanResult.getContents();
+ final String scan = scanResult.getContents();
if (StringUtils.isBlank(scan)) {
return;
}
@@ -456,7 +453,7 @@ public class MainActivity extends AbstractActionBarActivity {
cacheTypes.add(CacheType.MYSTERY);
// then add all other cache types sorted alphabetically
- List<CacheType> sorted = new ArrayList<CacheType>();
+ final List<CacheType> sorted = new ArrayList<CacheType>();
sorted.addAll(Arrays.asList(CacheType.values()));
sorted.removeAll(cacheTypes);
@@ -475,18 +472,18 @@ public class MainActivity extends AbstractActionBarActivity {
checkedItem = 0;
}
- String[] items = new String[cacheTypes.size()];
+ final String[] items = new String[cacheTypes.size()];
for (int i = 0; i < cacheTypes.size(); i++) {
items[i] = cacheTypes.get(i).getL10n();
}
- Builder builder = new AlertDialog.Builder(this);
+ final Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.menu_filter);
builder.setSingleChoiceItems(items, checkedItem, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int position) {
- CacheType cacheType = cacheTypes.get(position);
+ final CacheType cacheType = cacheTypes.get(position);
Settings.setCacheType(cacheType);
setFilterTitle();
dialog.dismiss();
@@ -546,7 +543,7 @@ public class MainActivity extends AbstractActionBarActivity {
navType.setText(res.getString(geo.getLocationProvider().resourceId));
if (geo.getAccuracy() >= 0) {
- int speed = Math.round(geo.getSpeed()) * 60 * 60 / 1000;
+ final int speed = Math.round(geo.getSpeed()) * 60 * 60 / 1000;
navAccuracy.setText("±" + Units.getDistanceFromMeters(geo.getAccuracy()) + Formatter.SEPARATOR + Units.getSpeed(speed));
} else {
navAccuracy.setText(null);
@@ -655,7 +652,7 @@ public class MainActivity extends AbstractActionBarActivity {
}
private class CountBubbleUpdateThread extends Thread {
- private Handler countBubbleHandler = new Handler() {
+ private final Handler countBubbleHandler = new Handler() {
@Override
public void handleMessage(final Message msg) {
@@ -667,7 +664,7 @@ public class MainActivity extends AbstractActionBarActivity {
countBubble.bringToFront();
countBubble.setVisibility(View.VISIBLE);
}
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.w("MainActivity.countBubbleHander", e);
}
}
@@ -684,7 +681,7 @@ public class MainActivity extends AbstractActionBarActivity {
try {
sleep(500);
checks++;
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("MainActivity.CountBubbleUpdateThread.run", e);
}
@@ -728,8 +725,8 @@ public class MainActivity extends AbstractActionBarActivity {
}
private void checkShowChangelog() {
- int lastVersion = Settings.getLastChangelogVersion();
- int version = Version.getVersionCode(this);
+ final int lastVersion = Settings.getLastChangelogVersion();
+ final int version = Version.getVersionCode(this);
Settings.setLastChangelogVersion(version);
// don't show change log after new install...
if (lastVersion > 0 && version != lastVersion) {