diff options
Diffstat (limited to 'main/src/cgeo/geocaching/ui')
8 files changed, 195 insertions, 141 deletions
diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java index 799b695..06fa1fa 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java @@ -51,7 +51,6 @@ public abstract class AbstractCachingListViewPageViewCreator extends AbstractCac int logViewPosition = state.getInt(STATE_POSITION); int logViewPositionFromTop = state.getInt(STATE_POSITION_FROM_TOP); view.setSelectionFromTop(logViewPosition, logViewPositionFromTop); - return; } } diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java index 0c67384..71cd3b4 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java @@ -52,6 +52,5 @@ public abstract class AbstractCachingPageViewCreator<ViewClass extends View> imp */ @Override public void setViewState(@NonNull Bundle state) { - return; } } diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 0d90d9f..3a451a5 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -45,6 +45,7 @@ import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -377,7 +378,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { final boolean lightSkin = Settings.isLightSkin(); - final TouchListener touchListener = new TouchListener(cache); + final TouchListener touchListener = new TouchListener(cache, this); v.setOnClickListener(touchListener); v.setOnLongClickListener(touchListener); v.setOnTouchListener(touchListener); @@ -536,24 +537,30 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { } } - private class TouchListener implements View.OnClickListener, View.OnLongClickListener, View.OnTouchListener { + private static class TouchListener implements View.OnClickListener, View.OnLongClickListener, View.OnTouchListener { private final Geocache cache; private final GestureDetector gestureDetector; + private final @NonNull WeakReference<CacheListAdapter> adapterRef; - public TouchListener(final Geocache cache) { + public TouchListener(final Geocache cache, final @NonNull CacheListAdapter adapter) { this.cache = cache; - gestureDetector = new GestureDetector(getContext(), new FlingGesture(cache)); + gestureDetector = new GestureDetector(adapter.getContext(), new FlingGesture(cache, adapter)); + adapterRef = new WeakReference<CacheListAdapter>(adapter); } // Tap on item @Override public void onClick(final View view) { - if (isSelectMode()) { + final CacheListAdapter adapter = adapterRef.get(); + if (adapter == null) { + return; + } + if (adapter.isSelectMode()) { cache.setStatusChecked(!cache.isStatusChecked()); - notifyDataSetChanged(); + adapter.notifyDataSetChanged(); } else { - CacheDetailActivity.startActivity(getContext(), cache.getGeocode(), cache.getName()); + CacheDetailActivity.startActivity(adapter.getContext(), cache.getGeocode(), cache.getName()); } } @@ -572,12 +579,14 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { } } - private class FlingGesture extends GestureDetector.SimpleOnGestureListener { + private static class FlingGesture extends GestureDetector.SimpleOnGestureListener { private final Geocache cache; + private final @NonNull WeakReference<CacheListAdapter> adapterRef; - public FlingGesture(final Geocache cache) { + public FlingGesture(final Geocache cache, final @NonNull CacheListAdapter adapter) { this.cache = cache; + adapterRef = new WeakReference<CacheListAdapter>(adapter); } @Override @@ -586,11 +595,15 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) { return false; } + final CacheListAdapter adapter = adapterRef.get(); + if (adapter == null) { + return false; + } // left to right swipe if ((e2.getX() - e1.getX()) > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > Math.abs(velocityY)) { - if (!selectMode) { - switchSelectMode(); + if (!adapter.selectMode) { + adapter.switchSelectMode(); cache.setStatusChecked(true); } return true; @@ -598,8 +611,8 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { // right to left swipe if ((e1.getX() - e2.getX()) > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > Math.abs(velocityY)) { - if (selectMode) { - switchSelectMode(); + if (adapter.selectMode) { + adapter.switchSelectMode(); } return true; } diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java index f7111f7..60982a9 100644 --- a/main/src/cgeo/geocaching/ui/CompassView.java +++ b/main/src/cgeo/geocaching/ui/CompassView.java @@ -3,10 +3,9 @@ package cgeo.geocaching.ui; import cgeo.geocaching.R; import cgeo.geocaching.utils.AngleUtils; -import rx.Scheduler; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; -import rx.functions.Action1; +import rx.functions.Action0; import android.content.Context; import android.content.res.Resources; @@ -18,6 +17,7 @@ import android.graphics.PaintFlagsDrawFilter; import android.util.AttributeSet; import android.view.View; +import java.lang.ref.WeakReference; import java.util.concurrent.TimeUnit; public class CompassView extends View { @@ -56,11 +56,40 @@ public class CompassView extends View { private boolean initialDisplay; private Subscription periodicUpdate; + private static final class UpdateAction implements Action0 { + + private final WeakReference<CompassView> compassViewRef; + + private UpdateAction(CompassView view) { + this.compassViewRef = new WeakReference<CompassView>(view); + } + + @Override + public void call() { + final CompassView compassView = compassViewRef.get(); + if (compassView == null) { + return; + } + compassView.updateGraphics(); + } + } + public CompassView(Context contextIn) { super(contextIn); context = contextIn; } + public void updateGraphics() { + final float newAzimuthShown = smoothUpdate(northMeasured, azimuthShown); + final float newCacheHeadingShown = smoothUpdate(cacheHeadingMeasured, cacheHeadingShown); + if (Math.abs(AngleUtils.difference(azimuthShown, newAzimuthShown)) >= 2 || + Math.abs(AngleUtils.difference(cacheHeadingShown, newCacheHeadingShown)) >= 2) { + azimuthShown = newAzimuthShown; + cacheHeadingShown = newCacheHeadingShown; + invalidate(); + } + } + public CompassView(Context contextIn, AttributeSet attrs) { super(contextIn, attrs); context = contextIn; @@ -88,24 +117,13 @@ public class CompassView extends View { initialDisplay = true; - periodicUpdate = AndroidSchedulers.mainThread().schedulePeriodically(new Action1<Scheduler.Inner>() { - @Override - public void call(final Scheduler.Inner inner) { - final float newAzimuthShown = smoothUpdate(northMeasured, azimuthShown); - final float newCacheHeadingShown = smoothUpdate(cacheHeadingMeasured, cacheHeadingShown); - if (Math.abs(AngleUtils.difference(azimuthShown, newAzimuthShown)) >= 2 || - Math.abs(AngleUtils.difference(cacheHeadingShown, newCacheHeadingShown)) >= 2) { - azimuthShown = newAzimuthShown; - cacheHeadingShown = newCacheHeadingShown; - invalidate(); - } - } - }, 0, 40, TimeUnit.MILLISECONDS); + periodicUpdate = AndroidSchedulers.mainThread().createWorker().schedulePeriodically(new UpdateAction(this), 0, 40, TimeUnit.MILLISECONDS); } @Override public void onDetachedFromWindow() { periodicUpdate.unsubscribe(); + super.onDetachedFromWindow(); if (compassUnderlay != null) { diff --git a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java index b2ce11a..00b5abe 100644 --- a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java +++ b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java @@ -1,12 +1,11 @@ package cgeo.geocaching.ui.dialog; import cgeo.geocaching.Geocache; -import cgeo.geocaching.sensors.IGeoData; import cgeo.geocaching.R; import cgeo.geocaching.activity.AbstractActivity; -import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter; +import cgeo.geocaching.sensors.IGeoData; import cgeo.geocaching.settings.Settings; import cgeo.geocaching.settings.Settings.CoordInputFormatEnum; import cgeo.geocaching.utils.EditUtils; @@ -14,9 +13,12 @@ import cgeo.geocaching.utils.EditUtils; import org.apache.commons.lang3.StringUtils; import android.os.Bundle; +import android.support.v4.app.DialogFragment; import android.text.Editable; import android.text.TextWatcher; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; @@ -25,12 +27,11 @@ import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; -public class CoordinatesInputDialog extends NoTitleDialog { +public class CoordinatesInputDialog extends DialogFragment { - final private AbstractActivity context; - final private IGeoData geo; - final private Geocache cache; private Geopoint gp; + private Geopoint gpinitial; + private Geopoint cacheCoords; private EditText eLat, eLon; private Button bLat, bLon; @@ -39,34 +40,64 @@ public class CoordinatesInputDialog extends NoTitleDialog { private TextView tLatSep1, tLatSep2, tLatSep3; private TextView tLonSep1, tLonSep2, tLonSep3; - private CoordinateUpdate cuListener; - private CoordInputFormatEnum currentFormat = null; - public CoordinatesInputDialog(final AbstractActivity context, final Geocache cache, final Geopoint gp, final IGeoData geo) { - super(context, ActivityMixin.getDialogTheme()); - this.context = context; - this.geo = geo; - this.cache = cache; + + private static final String GEOPOINT_ARG = "GEOPOINT"; + private static final String GEOPOINT_INTIAL_ARG = "GEOPOINT_INITIAL"; + private static final String CACHECOORDS_ARG = "CACHECOORDS"; + + + public static CoordinatesInputDialog getInstance(final Geocache cache, final Geopoint gp, final IGeoData geo) { + + Bundle args = new Bundle(); if (gp != null) { - this.gp = gp; + args.putParcelable(GEOPOINT_ARG, gp); } else if (geo != null && geo.getCoords() != null) { - this.gp = geo.getCoords(); + args.putParcelable(GEOPOINT_ARG, geo.getCoords()); } else { - this.gp = Geopoint.ZERO; + args.putParcelable(GEOPOINT_ARG, Geopoint.ZERO); } + + if (geo !=null) + args.putParcelable(GEOPOINT_INTIAL_ARG, geo.getCoords()); + + if (cache != null) + args.putParcelable(CACHECOORDS_ARG, cache.getCoords()); + + CoordinatesInputDialog cid = new CoordinatesInputDialog(); + cid.setArguments(args); + return cid; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + gp = getArguments().getParcelable(GEOPOINT_ARG); + gpinitial = getArguments().getParcelable(GEOPOINT_INTIAL_ARG); + cacheCoords = getArguments().getParcelable(CACHECOORDS_ARG); - setContentView(R.layout.coordinatesinput_dialog); + if (savedInstanceState != null && savedInstanceState.getParcelable(GEOPOINT_ARG)!=null) + gp = savedInstanceState.getParcelable(GEOPOINT_ARG); - final Spinner spinner = (Spinner) findViewById(R.id.spinnerCoordinateFormats); + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + // TODO: if current input is not commited in gp, read the current input into gp + outState.putParcelable(GEOPOINT_ARG, gp); + } + + @Override + public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { + getDialog().setTitle(R.string.cache_coordinates); + + View v = inflater.inflate(R.layout.coordinatesinput_dialog, container, false); + final Spinner spinner = (Spinner) v.findViewById(R.id.spinnerCoordinateFormats); final ArrayAdapter<CharSequence> adapter = - ArrayAdapter.createFromResource(context, + ArrayAdapter.createFromResource(getActivity(), R.array.waypoint_coordinate_formats, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); @@ -74,25 +105,25 @@ public class CoordinatesInputDialog extends NoTitleDialog { spinner.setSelection(Settings.getCoordInputFormat().ordinal()); spinner.setOnItemSelectedListener(new CoordinateFormatListener()); - bLat = (Button) findViewById(R.id.ButtonLat); - eLat = (EditText) findViewById(R.id.latitude); - eLatDeg = (EditText) findViewById(R.id.EditTextLatDeg); - eLatMin = (EditText) findViewById(R.id.EditTextLatMin); - eLatSec = (EditText) findViewById(R.id.EditTextLatSec); - eLatSub = (EditText) findViewById(R.id.EditTextLatSecFrac); - tLatSep1 = (TextView) findViewById(R.id.LatSeparator1); - tLatSep2 = (TextView) findViewById(R.id.LatSeparator2); - tLatSep3 = (TextView) findViewById(R.id.LatSeparator3); - - bLon = (Button) findViewById(R.id.ButtonLon); - eLon = (EditText) findViewById(R.id.longitude); - eLonDeg = (EditText) findViewById(R.id.EditTextLonDeg); - eLonMin = (EditText) findViewById(R.id.EditTextLonMin); - eLonSec = (EditText) findViewById(R.id.EditTextLonSec); - eLonSub = (EditText) findViewById(R.id.EditTextLonSecFrac); - tLonSep1 = (TextView) findViewById(R.id.LonSeparator1); - tLonSep2 = (TextView) findViewById(R.id.LonSeparator2); - tLonSep3 = (TextView) findViewById(R.id.LonSeparator3); + 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); eLatDeg.addTextChangedListener(new TextChanged(eLatDeg)); eLatMin.addTextChangedListener(new TextChanged(eLatMin)); @@ -115,18 +146,24 @@ public class CoordinatesInputDialog extends NoTitleDialog { bLat.setOnClickListener(new ButtonClickListener()); bLon.setOnClickListener(new ButtonClickListener()); - final Button buttonCurrent = (Button) findViewById(R.id.current); + final Button buttonCurrent = (Button) v.findViewById(R.id.current); buttonCurrent.setOnClickListener(new CurrentListener()); - final Button buttonCache = (Button) findViewById(R.id.cache); - if (cache != null) { + final Button buttonCache = (Button) v.findViewById(R.id.cache); + + if (cacheCoords != null) { buttonCache.setOnClickListener(new CacheListener()); } else { buttonCache.setVisibility(View.GONE); } - final Button buttonDone = (Button) findViewById(R.id.done); + + final Button buttonDone = (Button) v.findViewById(R.id.done); buttonDone.setOnClickListener(new InputDoneListener()); + + return v; } + + private void updateGUI() { if (gp == null) { return; @@ -137,14 +174,14 @@ public class CoordinatesInputDialog extends NoTitleDialog { switch (currentFormat) { case Plain: - findViewById(R.id.coordTable).setVisibility(View.GONE); + getView().findViewById(R.id.coordTable).setVisibility(View.GONE); eLat.setVisibility(View.VISIBLE); eLon.setVisibility(View.VISIBLE); eLat.setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE)); eLon.setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE)); break; case Deg: // DDD.DDDDD° - findViewById(R.id.coordTable).setVisibility(View.VISIBLE); + getView().findViewById(R.id.coordTable).setVisibility(View.VISIBLE); eLat.setVisibility(View.GONE); eLon.setVisibility(View.GONE); eLatSec.setVisibility(View.GONE); @@ -165,7 +202,7 @@ public class CoordinatesInputDialog extends NoTitleDialog { eLonMin.setText(addZeros(gp.getLonDegFrac(), 5)); break; case Min: // DDD° MM.MMM - findViewById(R.id.coordTable).setVisibility(View.VISIBLE); + getView().findViewById(R.id.coordTable).setVisibility(View.VISIBLE); eLat.setVisibility(View.GONE); eLon.setVisibility(View.GONE); eLatSec.setVisibility(View.VISIBLE); @@ -190,7 +227,7 @@ public class CoordinatesInputDialog extends NoTitleDialog { eLonSec.setText(addZeros(gp.getLonMinFrac(), 3)); break; case Sec: // DDD° MM SS.SSS - findViewById(R.id.coordTable).setVisibility(View.VISIBLE); + getView().findViewById(R.id.coordTable).setVisibility(View.VISIBLE); eLat.setVisibility(View.GONE); eLon.setVisibility(View.GONE); eLatSec.setVisibility(View.VISIBLE); @@ -371,7 +408,8 @@ public class CoordinatesInputDialog extends NoTitleDialog { // Signaled and returned below } if (signalError) { - context.showToast(context.getResources().getString(R.string.err_parse_lat_lon)); + final AbstractActivity activity = (AbstractActivity) getActivity(); + activity.showToast(activity.getResources().getString(R.string.err_parse_lat_lon)); } return false; } @@ -399,8 +437,8 @@ public class CoordinatesInputDialog extends NoTitleDialog { // Start new format with an acceptable value: either the current one // entered by the user, else our current coordinates, else (0,0). if (!areCurrentCoordinatesValid(false)) { - if (geo != null && geo.getCoords() != null) { - gp = geo.getCoords(); + if (gpinitial != null) { + gp = gpinitial; } else { gp = Geopoint.ZERO; } @@ -422,12 +460,13 @@ public class CoordinatesInputDialog extends NoTitleDialog { @Override public void onClick(View v) { - if (geo == null || geo.getCoords() == null) { - context.showToast(context.getResources().getString(R.string.err_point_unknown_position)); + if (gpinitial == null) { + final AbstractActivity activity = (AbstractActivity) getActivity(); + activity.showToast(activity.getResources().getString(R.string.err_point_unknown_position)); return; } - gp = geo.getCoords(); + gp = gpinitial; updateGUI(); } } @@ -436,16 +475,18 @@ public class CoordinatesInputDialog extends NoTitleDialog { @Override public void onClick(View v) { - if (cache == null || cache.getCoords() == null) { - context.showToast(context.getResources().getString(R.string.err_location_unknown)); + if (cacheCoords == null) { + final AbstractActivity activity = (AbstractActivity) getActivity(); + activity.showToast(activity.getResources().getString(R.string.err_location_unknown)); return; } - gp = cache.getCoords(); + gp = cacheCoords; updateGUI(); } } + private class InputDoneListener implements View.OnClickListener { @Override @@ -454,18 +495,14 @@ public class CoordinatesInputDialog extends NoTitleDialog { return; } if (gp != null) { - cuListener.update(gp); + ((CoordinateUpdate) getActivity()).updateCoordinates(gp); } dismiss(); } } - public void setOnCoordinateUpdate(CoordinateUpdate cu) { - cuListener = cu; - } - public interface CoordinateUpdate { - public void update(final Geopoint gp); + public void updateCoordinates(final Geopoint gp); } } diff --git a/main/src/cgeo/geocaching/ui/dialog/DateDialog.java b/main/src/cgeo/geocaching/ui/dialog/DateDialog.java index 18f8e2e..fc69f44 100644 --- a/main/src/cgeo/geocaching/ui/dialog/DateDialog.java +++ b/main/src/cgeo/geocaching/ui/dialog/DateDialog.java @@ -2,48 +2,56 @@ package cgeo.geocaching.ui.dialog; import cgeo.geocaching.R; -import android.app.Activity; import android.os.Bundle; +import android.support.v4.app.DialogFragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; import android.widget.DatePicker; import java.util.Calendar; -public class DateDialog extends NoTitleDialog { +public class DateDialog extends DialogFragment { public interface DateDialogParent { abstract public void setDate(final Calendar date); } - private final DateDialogParent parent; - private final Calendar date; + private Calendar date; - public DateDialog(Activity contextIn, DateDialogParent parentIn, Calendar dateIn) { - super(contextIn); - - // init - this.date = dateIn; - this.parent = parentIn; + public static DateDialog getInstance(Calendar date) { + DateDialog dd = new DateDialog(); + Bundle args = new Bundle(); + args.putSerializable("date", date); + dd.setArguments(args); + return dd; } @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setStyle(DialogFragment.STYLE_NO_TITLE, 0); + Bundle args = getArguments(); + date = (Calendar) args.getSerializable("date"); + } - setContentView(R.layout.date); + @Override + public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { + View v = inflater.inflate(R.layout.date, container, false); - final DatePicker picker = (DatePicker) findViewById(R.id.picker); + final DatePicker picker = (DatePicker) v.findViewById(R.id.picker); picker.init(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DATE), new DatePickerListener()); + return v; } private class DatePickerListener implements DatePicker.OnDateChangedListener { @Override public void onDateChanged(DatePicker picker, int year, int month, int day) { - if (parent != null) { - date.set(year, month, day); + date.set(year, month, day); + + ((DateDialogParent) getActivity()).setDate(date); - parent.setDate(date); - } } } }
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java index cb8926a..6a2f9a5 100644 --- a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java +++ b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java @@ -218,7 +218,19 @@ public final class Dialogs { /** * Show a message dialog with a single "OK" button. - * + * + * @param context + * activity owning the dialog + * @param message + * message dialog content + */ + public static void message(final Activity context, final int message) { + message(context, null, getString(message)); + } + + /** + * Show a message dialog with a single "OK" button. + * * @param context * activity owning the dialog * @param title diff --git a/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java b/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java deleted file mode 100644 index 8660a7b..0000000 --- a/main/src/cgeo/geocaching/ui/dialog/NoTitleDialog.java +++ /dev/null @@ -1,32 +0,0 @@ -package cgeo.geocaching.ui.dialog; - -import cgeo.geocaching.utils.Log; - -import android.app.Dialog; -import android.content.Context; -import android.os.Bundle; -import android.view.ViewGroup.LayoutParams; -import android.view.Window; - -public abstract class NoTitleDialog extends Dialog { - - public NoTitleDialog(Context context) { - super(context); - } - - public NoTitleDialog(Context context, int theme) { - super(context, theme); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - try { - requestWindowFeature(Window.FEATURE_NO_TITLE); - getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - } catch (final Exception e) { - Log.e("NoTitleDialog.onCreate", e); - } - } -} |
