diff options
Diffstat (limited to 'main/src/cgeo/geocaching/CacheDetailActivity.java')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index c230948..813d1da 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -84,13 +84,11 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.Button; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; +import android.widget.RadioButton; import android.widget.ScrollView; import android.widget.TextView; import android.widget.TextView.BufferType; @@ -2245,10 +2243,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc /** * A dialog to allow the user to select reseting coordinates local/remote/both. */ - private class ResetCacheCoordinatesDialog extends AlertDialog implements OnCheckedChangeListener { + private class ResetCacheCoordinatesDialog extends AlertDialog { - final CheckBox uploadOption; - final CheckBox resetLocalyOption; + final RadioButton resetBoth; + final RadioButton resetLocal; public ResetCacheCoordinatesDialog(final cgCache cache, final Waypoint wpt, final Activity activity) { super(activity); @@ -2256,17 +2254,13 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc View layout = activity.getLayoutInflater().inflate(R.layout.reset_cache_coords_dialog, null); setView(layout); - uploadOption = (CheckBox) layout.findViewById(R.id.upload); - resetLocalyOption = (CheckBox) layout.findViewById(R.id.local); + resetLocal = (RadioButton) layout.findViewById(R.id.reset_cache_coordinates_local); + resetBoth = (RadioButton) layout.findViewById(R.id.reset_cache_coordinates_local_and_remote); if (ConnectorFactory.getConnector(cache).supportsOwnCoordinates()) { - uploadOption.setChecked(true); - uploadOption.setVisibility(View.VISIBLE); + resetBoth.setVisibility(View.VISIBLE); } - uploadOption.setOnCheckedChangeListener(this); - resetLocalyOption.setOnCheckedChangeListener(this); - layout.findViewById(R.id.reset).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -2284,23 +2278,17 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc remoteFinished = true; } - if ((localFinished || !resetLocalyOption.isChecked()) && (remoteFinished || !uploadOption.isChecked())) { + if ((localFinished) && (remoteFinished || !resetBoth.isChecked())) { p.dismiss(); notifyDataSetChanged(); } } }; - new ResetCoordsThread(cache, h, wpt, resetLocalyOption.isChecked(), uploadOption.isChecked(), p).start(); + new ResetCoordsThread(cache, h, wpt, resetLocal.isChecked() || resetBoth.isChecked(), resetBoth.isChecked(), p).start(); } }); } - - @Override - public void onCheckedChanged(CompoundButton arg0, boolean arg1) { - findViewById(R.id.reset).setEnabled( - (uploadOption.isChecked() || resetLocalyOption.isChecked())); - } } private class ResetCoordsThread extends Thread { |
