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 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 String APP_EXIT_KEY = "APP_EXIT_KEY";
private OsmandApplication app;

View file

@ -1,12 +1,16 @@
package net.osmand.plus.dialogs;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import net.osmand.PlatformUtil;
import net.osmand.plus.AppInitializer;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
@ -15,7 +19,6 @@ import org.apache.commons.logging.Log;
public class WhatsNewDialogFragment extends DialogFragment {
private static final Log LOG = PlatformUtil.getLog(WhatsNewDialogFragment.class);
private static final String FILE_ANDROID_ASSET_HELP = "file:///android_asset/help/";
@NonNull
@Override
@ -27,7 +30,15 @@ public class WhatsNewDialogFragment extends DialogFragment {
.setMessage(getString(R.string.last_release))
.setNegativeButton(R.string.shared_string_close, null);
// 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();
}
}

View file

@ -7,7 +7,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.app.DialogFragment;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
@ -18,6 +17,7 @@ import android.widget.TextView;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.Version;
@ -110,7 +110,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
@Override
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
if(categories[groupPosition] == MenuCategory.HELP_US_TO_IMPROVE) {
if (categories[groupPosition] == MenuCategory.HELP_US_TO_IMPROVE) {
convertView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.help_to_improve_item, parent, false);
TextView pollButton = (TextView) convertView.findViewById(R.id.pollButton);
@ -260,89 +260,56 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
}
private List<MyMenuItem> createBeginWithOsmandItems(){
private List<MyMenuItem> createBeginWithOsmandItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>();
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());
arrayList.add(builder.create());
builder = new MyMenuItem.Builder()
.setTitle(R.string.shared_string_navigation)
.setTitle(R.string.shared_string_navigation, getActivity())
.setDescription(R.string.navigation_item_description, getActivity());
arrayList.add(builder.create());
builder = new MyMenuItem.Builder()
.setTitle(R.string.faq_item)
.setTitle(R.string.faq_item, getActivity())
.setDescription(R.string.faq_item_description, getActivity());
arrayList.add(builder.create());
return arrayList;
}
private static List<MyMenuItem> createFeaturesItems() {
private List<MyMenuItem> createFeaturesItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>();
arrayList.add(new MyMenuItem(R.string.map_viewing_item));
arrayList.add(new MyMenuItem(R.string.search_on_the_map_item));
arrayList.add(new MyMenuItem(R.string.planning_trip_item));
arrayList.add(new MyMenuItem(R.string.map_viewing_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.search_on_the_map_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.planning_trip_item, getActivity()));
return arrayList;
}
private List<MyMenuItem> createPluginsItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>();
MyMenuItem.Builder builder = new MyMenuItem.Builder()
.setTitle(R.string.shared_string_online_maps)
.setIcon(R.drawable.ic_world_globe_dark)
.setListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HelpArticleDialogFragment.createInstance(
"feature_articles/online-maps-plugin.html")
.show(getActivity().getSupportFragmentManager(), null);
}
});
arrayList.add(builder.create());
builder.reset()
.setTitle(R.string.contour_lines_and_hillshade_maps_item)
.setIcon(R.drawable.ic_plugin_srtm);
arrayList.add(builder.create());
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());
MyMenuItem.Builder builder = new MyMenuItem.Builder();
for (OsmandPlugin osmandPlugin : OsmandPlugin.getAvailablePlugins()) {
builder.reset();
builder.setTitle(osmandPlugin.getName())
.setIcon(osmandPlugin.getLogoResourceId());
arrayList.add(builder.create());
}
// .setListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// HelpArticleDialogFragment.createInstance(
// "feature_articles/online-maps-plugin.html")
// .show(getActivity().getSupportFragmentManager(), null);
// }
// });
return arrayList;
}
private List<MyMenuItem> createOtherItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>();
arrayList.add(new MyMenuItem(R.string.instalation_troubleshooting_item));
arrayList.add(new MyMenuItem(R.string.techical_articles_item));
arrayList.add(new MyMenuItem(R.string.versions_item));
arrayList.add(new MyMenuItem(R.string.instalation_troubleshooting_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.techical_articles_item, getActivity()));
arrayList.add(new MyMenuItem(R.string.versions_item, getActivity()));
String releasedate = "";
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);
MyMenuItem.Builder builder = new MyMenuItem.Builder()
.setTitle(R.string.shared_string_about)
.setTitle(R.string.shared_string_about, getActivity())
.setDescription(version);
arrayList.add(builder.create());

View file

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