What's new finished

This commit is contained in:
GaidamakUA 2015-11-02 14:00:47 +02:00
parent 3e69b1b5f7
commit 13d1d5004f
4 changed files with 64 additions and 87 deletions

View file

@ -65,7 +65,7 @@ public class AppInitializer implements IProgress {
private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$ private static final String VERSION_INSTALLED = "VERSION_INSTALLED"; //$NON-NLS-1$
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$ private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
public static final String LATEST_CHANGES_URL = "changes-2.1.html"; public static final String LATEST_CHANGES_URL = "http://osmand.net/changes-2.1.html";
public static final int APP_EXIT_CODE = 4; public static final int APP_EXIT_CODE = 4;
public static final String APP_EXIT_KEY = "APP_EXIT_KEY"; public static final String APP_EXIT_KEY = "APP_EXIT_KEY";
private OsmandApplication app; private OsmandApplication app;

View file

@ -1,12 +1,16 @@
package net.osmand.plus.dialogs; package net.osmand.plus.dialogs;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
@ -15,7 +19,6 @@ import org.apache.commons.logging.Log;
public class WhatsNewDialogFragment extends DialogFragment { public class WhatsNewDialogFragment extends DialogFragment {
private static final Log LOG = PlatformUtil.getLog(WhatsNewDialogFragment.class); private static final Log LOG = PlatformUtil.getLog(WhatsNewDialogFragment.class);
private static final String FILE_ANDROID_ASSET_HELP = "file:///android_asset/help/";
@NonNull @NonNull
@Override @Override
@ -27,7 +30,15 @@ public class WhatsNewDialogFragment extends DialogFragment {
.setMessage(getString(R.string.last_release)) .setMessage(getString(R.string.last_release))
.setNegativeButton(R.string.shared_string_close, null); .setNegativeButton(R.string.shared_string_close, null);
// TODO: 10/28/15 Implement // TODO: 10/28/15 Implement
builder.setPositiveButton("Read more", null); builder.setPositiveButton("Read more", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(AppInitializer.LATEST_CHANGES_URL));
startActivity(i);
dismiss();
}
});
return builder.create(); return builder.create();
} }
} }

View file

@ -7,7 +7,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -18,6 +17,7 @@ import android.widget.TextView;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
@ -263,86 +263,53 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
private List<MyMenuItem> createBeginWithOsmandItems() { private List<MyMenuItem> createBeginWithOsmandItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<MyMenuItem> arrayList = new ArrayList<>();
MyMenuItem.Builder builder = new MyMenuItem.Builder() MyMenuItem.Builder builder = new MyMenuItem.Builder()
.setTitle(R.string.first_usage_item) .setTitle(R.string.first_usage_item, getActivity())
.setDescription(R.string.first_usage_item_description, getActivity()); .setDescription(R.string.first_usage_item_description, getActivity());
arrayList.add(builder.create()); arrayList.add(builder.create());
builder = new MyMenuItem.Builder() builder = new MyMenuItem.Builder()
.setTitle(R.string.shared_string_navigation) .setTitle(R.string.shared_string_navigation, getActivity())
.setDescription(R.string.navigation_item_description, getActivity()); .setDescription(R.string.navigation_item_description, getActivity());
arrayList.add(builder.create()); arrayList.add(builder.create());
builder = new MyMenuItem.Builder() builder = new MyMenuItem.Builder()
.setTitle(R.string.faq_item) .setTitle(R.string.faq_item, getActivity())
.setDescription(R.string.faq_item_description, getActivity()); .setDescription(R.string.faq_item_description, getActivity());
arrayList.add(builder.create()); arrayList.add(builder.create());
return arrayList; return arrayList;
} }
private static List<MyMenuItem> createFeaturesItems() { private List<MyMenuItem> createFeaturesItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<MyMenuItem> arrayList = new ArrayList<>();
arrayList.add(new MyMenuItem(R.string.map_viewing_item)); arrayList.add(new MyMenuItem(R.string.map_viewing_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.search_on_the_map_item)); arrayList.add(new MyMenuItem(R.string.search_on_the_map_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.planning_trip_item)); arrayList.add(new MyMenuItem(R.string.planning_trip_item, getActivity()));
return arrayList; return arrayList;
} }
private List<MyMenuItem> createPluginsItems() { private List<MyMenuItem> createPluginsItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<MyMenuItem> arrayList = new ArrayList<>();
MyMenuItem.Builder builder = new MyMenuItem.Builder() MyMenuItem.Builder builder = new MyMenuItem.Builder();
.setTitle(R.string.shared_string_online_maps) for (OsmandPlugin osmandPlugin : OsmandPlugin.getAvailablePlugins()) {
.setIcon(R.drawable.ic_world_globe_dark) builder.reset();
.setListener(new View.OnClickListener() { builder.setTitle(osmandPlugin.getName())
@Override .setIcon(osmandPlugin.getLogoResourceId());
public void onClick(View v) { arrayList.add(builder.create());
HelpArticleDialogFragment.createInstance(
"feature_articles/online-maps-plugin.html")
.show(getActivity().getSupportFragmentManager(), null);
} }
}); // .setListener(new View.OnClickListener() {
arrayList.add(builder.create()); // @Override
builder.reset() // public void onClick(View v) {
.setTitle(R.string.contour_lines_and_hillshade_maps_item) // HelpArticleDialogFragment.createInstance(
.setIcon(R.drawable.ic_plugin_srtm); // "feature_articles/online-maps-plugin.html")
arrayList.add(builder.create()); // .show(getActivity().getSupportFragmentManager(), null);
builder.reset() // }
.setTitle(R.string.trip_recording_tool_item) // });
.setIcon(R.drawable.ic_action_polygom_dark);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.osmand_ski_maps_item)
.setIcon(R.drawable.ic_plugin_skimaps);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.nautical_charts_item)
.setIcon(R.drawable.ic_action_sail_boat_dark);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.audio_video_note_item)
.setIcon(R.drawable.ic_action_micro_dark);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.osm_editing_item)
.setIcon(R.drawable.ic_action_bug_dark);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.osmand_distance_planning_plugin_name)
.setIcon(R.drawable.ic_action_ruler);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.poi_filter_parking)
.setIcon(R.drawable.ic_action_parking_dark);
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.debugging_and_development)
.setIcon(R.drawable.ic_plugin_developer);
arrayList.add(builder.create());
return arrayList; return arrayList;
} }
private List<MyMenuItem> createOtherItems() { private List<MyMenuItem> createOtherItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<MyMenuItem> arrayList = new ArrayList<>();
arrayList.add(new MyMenuItem(R.string.instalation_troubleshooting_item)); arrayList.add(new MyMenuItem(R.string.instalation_troubleshooting_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.techical_articles_item)); arrayList.add(new MyMenuItem(R.string.techical_articles_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.versions_item)); arrayList.add(new MyMenuItem(R.string.versions_item, getActivity()));
String releasedate = ""; String releasedate = "";
if (!this.getString(R.string.app_edition).equals("")) { if (!this.getString(R.string.app_edition).equals("")) {
@ -352,7 +319,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
// + "\n\n" + this.getString(R.string.about_content); // + "\n\n" + this.getString(R.string.about_content);
MyMenuItem.Builder builder = new MyMenuItem.Builder() MyMenuItem.Builder builder = new MyMenuItem.Builder()
.setTitle(R.string.shared_string_about) .setTitle(R.string.shared_string_about, getActivity())
.setDescription(version); .setDescription(version);
arrayList.add(builder.create()); arrayList.add(builder.create());

View file

@ -6,35 +6,30 @@ import android.support.annotation.StringRes;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
public class MyMenuItem { public class MyMenuItem {
private final int title; private final String title;
private final String desription; private final String desription;
@DrawableRes @DrawableRes
private final int icon; private final int icon;
private final OnClickListener onClickListener; private final OnClickListener onClickListener;
public MyMenuItem(@StringRes int title) { public MyMenuItem(String title) {
this.title = title; this(title, null);
this.onClickListener = null;
desription = null;
icon = -1;
} }
public MyMenuItem(@StringRes int title, OnClickListener onClickListener) { public MyMenuItem(@StringRes int title, Context context) {
this.title = title; this(context.getString(title));
this.onClickListener = onClickListener;
desription = null;
icon = -1;
} }
private MyMenuItem(@StringRes int title, @StringRes int desription, @DrawableRes int icon, public MyMenuItem(String title, OnClickListener onClickListener) {
this(title, null, -1, onClickListener);
}
private MyMenuItem(String title, @StringRes int desription, @DrawableRes int icon,
Context context, OnClickListener onClickListener) { Context context, OnClickListener onClickListener) {
this.title = title; this(title, context.getString(desription), icon, onClickListener);
this.onClickListener = onClickListener;
this.desription = context.getString(desription);
this.icon = icon;
} }
private MyMenuItem(@StringRes int title, String desription, @DrawableRes int icon, private MyMenuItem(String title, String desription, @DrawableRes int icon,
OnClickListener onClickListener) { OnClickListener onClickListener) {
this.title = title; this.title = title;
this.desription = desription; this.desription = desription;
@ -42,7 +37,7 @@ public class MyMenuItem {
this.onClickListener = onClickListener; this.onClickListener = onClickListener;
} }
public int getTitle() { public String getTitle() {
return title; return title;
} }
@ -59,13 +54,17 @@ public class MyMenuItem {
} }
public static class Builder { public static class Builder {
@StringRes private String title = null;
private int title = -1;
private String description = null; private String description = null;
private int icon = -1; private int icon = -1;
private OnClickListener listener; private OnClickListener listener;
public Builder setTitle(@StringRes int title) { public Builder setTitle(@StringRes int titleId, Context context) {
this.title = context.getString(titleId);
return this;
}
public Builder setTitle(String title) {
this.title = title; this.title = title;
return this; return this;
} }
@ -91,7 +90,7 @@ public class MyMenuItem {
} }
public Builder reset() { public Builder reset() {
title = -1; title = null;
description = null; description = null;
icon = -1; icon = -1;
listener = null; listener = null;