Skip to content

Commit

Permalink
Refactor names
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynovikov committed Feb 2, 2024
1 parent 4671620 commit 9f2cf03
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 72 deletions.
18 changes: 9 additions & 9 deletions app/src/main/java/mobi/maptrek/IntroductionActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.github.appintro.AppIntro;
import com.github.appintro.model.SliderPage;

import mobi.maptrek.fragments.IntroductionFragment;
import mobi.maptrek.fragments.Introduction;

public class IntroductionActivity extends AppIntro {
public static final int CURRENT_INTRODUCTION = 6;
Expand All @@ -48,54 +48,54 @@ protected void onCreate(Bundle savedInstanceState) {
sliderPage.setTitle(getString(R.string.introOfflineMapsTitle));
sliderPage.setDescription(getString(R.string.introOfflineMaps));
sliderPage.setImageDrawable(R.mipmap.maps);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));

sliderPage.setTitle(getString(R.string.introPlacesTitle));
sliderPage.setDescription(getString(R.string.introPlaces));
sliderPage.setImageDrawable(R.mipmap.places);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));

sliderPage.setTitle(getString(R.string.introTracksTitle));
sliderPage.setDescription(getString(R.string.introTracks));
sliderPage.setImageDrawable(R.mipmap.tracking);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));

sliderPage.setTitle(getString(R.string.introOffroadTitle));
sliderPage.setDescription(getString(R.string.introOffroad));
sliderPage.setImageDrawable(R.mipmap.offroad);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));
}

if (lastSeenIntroduction < 3) {
// 2017.11
sliderPage.setTitle(getString(R.string.introHikingTitle));
sliderPage.setDescription(getString(R.string.introHiking));
sliderPage.setImageDrawable(R.mipmap.hiking);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));
}

if (lastSeenIntroduction < 6) {
// 2021.03
sliderPage.setTitle(getString(R.string.introCyclingTitle));
sliderPage.setDescription(getString(R.string.introCycling));
sliderPage.setImageDrawable(R.mipmap.cycling);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));
}

if (lastSeenIntroduction < 3) {
// 2017.11
sliderPage.setTitle(getString(R.string.introSkiingTitle));
sliderPage.setDescription(getString(R.string.introSkiing));
sliderPage.setImageDrawable(R.mipmap.skiing);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));
}

if (lastSeenIntroduction < 5) {
// 2019.09
sliderPage.setTitle(getString(R.string.introNightModeTitle));
sliderPage.setDescription(getString(R.string.introNightMode));
sliderPage.setImageDrawable(R.mipmap.night);
addSlide(IntroductionFragment.newInstance(sliderPage));
addSlide(Introduction.newInstance(sliderPage));
}

// TODO Do not show more then N slides at once
Expand Down
50 changes: 25 additions & 25 deletions app/src/main/java/mobi/maptrek/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@
import mobi.maptrek.data.style.TrackStyle;
import mobi.maptrek.databinding.ActivityMainBinding;
import mobi.maptrek.fragments.AmenityInformation;
import mobi.maptrek.fragments.AmenitySetupDialog;
import mobi.maptrek.fragments.BaseMapDownload;
import mobi.maptrek.dialogs.AmenitySetup;
import mobi.maptrek.dialogs.BaseMapDownload;
import mobi.maptrek.fragments.CrashReport;
import mobi.maptrek.fragments.DataExport;
import mobi.maptrek.dialogs.DataExport;
import mobi.maptrek.fragments.DataList;
import mobi.maptrek.fragments.DataSourceList;
import mobi.maptrek.fragments.FragmentHolder;
import mobi.maptrek.fragments.Legend;
import mobi.maptrek.fragments.LocationInformation;
import mobi.maptrek.fragments.LocationShareDialog;
import mobi.maptrek.dialogs.LocationShare;
import mobi.maptrek.fragments.MapList;
import mobi.maptrek.fragments.MapSelection;
import mobi.maptrek.fragments.MarkerInformation;
Expand All @@ -215,12 +215,12 @@
import mobi.maptrek.fragments.PanelMenuItem;
import mobi.maptrek.fragments.RouteInformation;
import mobi.maptrek.fragments.Ruler;
import mobi.maptrek.fragments.TextSearchFragment;
import mobi.maptrek.fragments.TextSearch;
import mobi.maptrek.fragments.TrackInformation;
import mobi.maptrek.fragments.TrackProperties;
import mobi.maptrek.dialogs.TrackProperties;
import mobi.maptrek.fragments.WaypointInformation;
import mobi.maptrek.fragments.WaypointPropertiesDialog;
import mobi.maptrek.fragments.WhatsNewDialog;
import mobi.maptrek.dialogs.WaypointProperties;
import mobi.maptrek.dialogs.WhatsNew;
import mobi.maptrek.fragments.preferences.BasePreferences;
import mobi.maptrek.io.Manager;
import mobi.maptrek.io.TrackManager;
Expand Down Expand Up @@ -283,7 +283,7 @@ public class MainActivity extends AppCompatActivity implements ILocationListener
Map.UpdateListener,
GestureListener,
FragmentHolder,
WaypointPropertiesDialog.OnWaypointPropertiesChangedListener,
WaypointProperties.OnWaypointPropertiesChangedListener,
TrackProperties.OnTrackPropertiesChangedListener,
OnLocationListener,
OnWaypointActionListener,
Expand All @@ -295,7 +295,7 @@ public class MainActivity extends AppCompatActivity implements ILocationListener
MapTrekTileLayer.OnAmenityGestureListener,
PopupMenu.OnMenuItemClickListener,
LoaderManager.LoaderCallbacks<List<FileDataSource>>,
AmenitySetupDialog.AmenitySetupDialogCallback, SafeResultReceiver.Callback {
AmenitySetup.AmenitySetupDialogCallback, SafeResultReceiver.Callback {
private static final Logger logger = LoggerFactory.getLogger(MainActivity.class);

private static final int PERMISSIONS_REQUEST_FINE_LOCATION = 1;
Expand Down Expand Up @@ -1030,8 +1030,8 @@ public void onAnimationEnd(Animator animation) {
BaseMapDownload dialogFragment = new BaseMapDownload();
dialogFragment.show(mFragmentManager, "baseMapDownload");
mBaseMapWarningShown = true;
} else if (WhatsNewDialog.shouldShow()) {
WhatsNewDialog dialogFragment = new WhatsNewDialog();
} else if (WhatsNew.shouldShow()) {
WhatsNew dialogFragment = new WhatsNew();
dialogFragment.show(mFragmentManager, "whatsNew");
}

Expand Down Expand Up @@ -1292,8 +1292,8 @@ public boolean onMenuItemClick(MenuItem item) {
dialog.show();
return true;
} else if (action == R.id.actionAmenityZooms) {
AmenitySetupDialog.Builder builder = new AmenitySetupDialog.Builder();
AmenitySetupDialog dialog = builder.setCallback(this).create();
AmenitySetup.Builder builder = new AmenitySetup.Builder();
AmenitySetup dialog = builder.setCallback(this).create();
dialog.show(mFragmentManager, "amenitySetup");
return true;
} else if (action == R.id.actionOtherFeatures) {
Expand Down Expand Up @@ -1430,18 +1430,18 @@ public boolean onMenuItemClick(MenuItem item) {
Bundle args = new Bundle(2);
if (mLocationState != LocationState.DISABLED && mLocationService != null) {
Location location = mLocationService.getLocation();
args.putDouble(TextSearchFragment.ARG_LATITUDE, location.getLatitude());
args.putDouble(TextSearchFragment.ARG_LONGITUDE, location.getLongitude());
args.putDouble(TextSearch.ARG_LATITUDE, location.getLatitude());
args.putDouble(TextSearch.ARG_LONGITUDE, location.getLongitude());
} else {
MapPosition position = mMap.getMapPosition();
args.putDouble(TextSearchFragment.ARG_LATITUDE, position.getLatitude());
args.putDouble(TextSearchFragment.ARG_LONGITUDE, position.getLongitude());
args.putDouble(TextSearch.ARG_LATITUDE, position.getLatitude());
args.putDouble(TextSearch.ARG_LONGITUDE, position.getLongitude());
}
if (mFragmentManager.getBackStackEntryCount() > 0) {
popAll();
}
FragmentFactory factory = mFragmentManager.getFragmentFactory();
Fragment fragment = factory.instantiate(getClassLoader(), TextSearchFragment.class.getName());
Fragment fragment = factory.instantiate(getClassLoader(), TextSearch.class.getName());
fragment.setArguments(args);
showExtendPanel(PANEL_STATE.MORE, "search", fragment);
return true;
Expand Down Expand Up @@ -2509,7 +2509,7 @@ public void showMarkerInformation(@NonNull GeoPoint point, @Nullable String name

private void onWaypointProperties(Waypoint waypoint) {
mEditedWaypoint = waypoint;
WaypointPropertiesDialog dialogFragment = new WaypointPropertiesDialog(waypoint);
WaypointProperties dialogFragment = new WaypointProperties(waypoint);
dialogFragment.show(mFragmentManager, "waypointProperties");
}

Expand Down Expand Up @@ -3031,13 +3031,13 @@ public void onFeatureDetails(long id, boolean fromList) {

@Override
public void shareLocation(@NonNull GeoPoint coordinates, @Nullable String name) {
LocationShareDialog dialogFragment = new LocationShareDialog();
LocationShare dialogFragment = new LocationShare();
Bundle args = new Bundle();
args.putDouble(LocationShareDialog.ARG_LATITUDE, coordinates.getLatitude());
args.putDouble(LocationShareDialog.ARG_LONGITUDE, coordinates.getLongitude());
args.putInt(LocationShareDialog.ARG_ZOOM, mMap.getMapPosition().getZoomLevel());
args.putDouble(LocationShare.ARG_LATITUDE, coordinates.getLatitude());
args.putDouble(LocationShare.ARG_LONGITUDE, coordinates.getLongitude());
args.putInt(LocationShare.ARG_ZOOM, mMap.getMapPosition().getZoomLevel());
if (name != null)
args.putString(LocationShareDialog.ARG_NAME, name);
args.putString(LocationShare.ARG_NAME, name);
dialogFragment.setArguments(args);
dialogFragment.show(mFragmentManager, "locationShare");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
Expand Down Expand Up @@ -44,7 +44,7 @@
import mobi.maptrek.util.ResUtils;
import mobi.maptrek.view.DiscreteSlider;

public class AmenitySetupDialog extends DialogFragment {
public class AmenitySetup extends DialogFragment {
private AmenitySetupDialogCallback mCallback;

public interface AmenitySetupDialogCallback {
Expand Down Expand Up @@ -105,8 +105,8 @@ public Builder setCallback(AmenitySetupDialogCallback callback) {
return this;
}

public AmenitySetupDialog create() {
AmenitySetupDialog dialogFragment = new AmenitySetupDialog();
public AmenitySetup create() {
AmenitySetup dialogFragment = new AmenitySetup();
Bundle args = new Bundle();

if (mTitle != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.annotation.SuppressLint;
import android.app.Activity;
Expand All @@ -39,7 +39,7 @@
import mobi.maptrek.R;
import mobi.maptrek.util.JosmCoordinatesParser;

public class CoordinatesInputDialog extends DialogFragment {
public class CoordinatesInput extends DialogFragment {
private int mColorTextPrimary;
private int mColorDarkBlue;
private int mColorRed;
Expand Down Expand Up @@ -172,8 +172,8 @@ public Builder setCallbacks(CoordinatesInputDialogCallback callbacks) {
return this;
}

public CoordinatesInputDialog create() {
CoordinatesInputDialog dialogFragment = new CoordinatesInputDialog();
public CoordinatesInput create() {
CoordinatesInput dialogFragment = new CoordinatesInput();
Bundle args = new Bundle();

if (mTitle != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.annotation.SuppressLint;
import android.app.Activity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.app.Activity;
import android.app.AlertDialog;
Expand Down Expand Up @@ -49,7 +49,7 @@
import mobi.maptrek.util.Osm;
import mobi.maptrek.util.StringFormatter;

public class LocationShareDialog extends DialogFragment implements DialogInterface.OnClickListener {
public class LocationShare extends DialogFragment implements DialogInterface.OnClickListener {

public static final String ARG_LATITUDE = "latitude";
public static final String ARG_LONGITUDE = "longitude";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
Expand All @@ -36,19 +36,19 @@
import mobi.maptrek.data.Waypoint;
import mobi.maptrek.data.style.MarkerStyle;

public class WaypointPropertiesDialog extends DialogFragment {
public class WaypointProperties extends DialogFragment {
private EditText mNameEdit;
private ColorPickerSwatch mColorSwatch;
private String mName;
private int mColor;

private OnWaypointPropertiesChangedListener mListener;

public WaypointPropertiesDialog() {
public WaypointProperties() {
super();
}

public WaypointPropertiesDialog(Waypoint waypoint) {
public WaypointProperties(Waypoint waypoint) {
super();
mName = waypoint.name;
mColor = waypoint.style.color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

package mobi.maptrek.fragments;
package mobi.maptrek.dialogs;

import android.app.AlertDialog;
import android.app.Dialog;
Expand Down Expand Up @@ -46,7 +46,7 @@
import mobi.maptrek.MapTrek;
import mobi.maptrek.R;

public class WhatsNewDialog extends DialogFragment {
public class WhatsNew extends DialogFragment {
private static final String TAG_CHANGELOG = "changelog";
private static final String TAG_RELEASE = "release";
private static final String TAG_CHANGE = "change";
Expand All @@ -62,7 +62,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
final View dialogView = getLayoutInflater().inflate(R.layout.dialog_list, null);

final ListView listView = dialogView.findViewById(android.R.id.list);
WhatsNewDialog.ChangeListAdapter listAdapter = new WhatsNewDialog.ChangeListAdapter();
WhatsNew.ChangeListAdapter listAdapter = new WhatsNew.ChangeListAdapter();
listView.setAdapter(listAdapter);

AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext());
Expand Down Expand Up @@ -204,11 +204,11 @@ public boolean isEnabled(int position) {

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
WhatsNewDialog.ChangeListItemHolder itemHolder;
WhatsNew.ChangeListItemHolder itemHolder;
final ChangeListItem item = getItem(position);

if (convertView == null) {
itemHolder = new WhatsNewDialog.ChangeListItemHolder();
itemHolder = new WhatsNew.ChangeListItemHolder();
if (item.version != null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_change_title, parent, false);
itemHolder.divider = convertView.findViewById(R.id.group_divider);
Expand All @@ -220,7 +220,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
}
convertView.setTag(itemHolder);
} else {
itemHolder = (WhatsNewDialog.ChangeListItemHolder) convertView.getTag();
itemHolder = (WhatsNew.ChangeListItemHolder) convertView.getTag();
}

if (item.version != null) {
Expand Down
Loading

0 comments on commit 9f2cf03

Please sign in to comment.