Help fixes

This commit is contained in:
GaidamakUA 2015-11-03 16:39:13 +02:00
parent a38cf3d368
commit 8b6ed12f83
20 changed files with 135 additions and 104 deletions

View file

@ -198,25 +198,25 @@ task collectFonts(type: Copy) {
include "*.ttf" include "*.ttf"
} }
task collectHelpContentsAssets(type: Sync) { task collectHelpContentsAssets(type: Copy) {
from "../../help/help" from("assets/") {
into "assets/help" // include "style.css"
include "*.html" }
include "images/**/*.png" from("../../help/help-online") {
from "assets/"
into "assets/help"
include "style.css"
from "../../help/website/feature_articles"
into "assets/feature_articles"
include "*.html"
from "../../help/help_online"
into "assets/feature_articles"
include "TechnicalArticles.html" include "TechnicalArticles.html"
include "about.html" include "about.html"
} }
from("../../help/help") {
include "faq.html"
include "osmo-plugin.html"
include "changes.html"
}
from("../../help/website/feature_articles"){
include "*.html"
}
into "assets/feature_articles"
}
task collectRoutingResources(type: Sync) { task collectRoutingResources(type: Sync) {
from "../../resources/routing" from "../../resources/routing"

View file

@ -8,12 +8,12 @@
android:paddingBottom="16dp"> android:paddingBottom="16dp">
<TextView <TextView
android:id="@+id/pollButton" android:id="@+id/feedbackButton"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:text="@string/poll" android:text="@string/feedback"
tools:drawableTop="@drawable/ic_action_message"/> tools:drawableTop="@drawable/ic_action_message"/>
<View <View

View file

@ -1969,5 +1969,5 @@
<string name="simulate_initial_startup">Імітаваць першы старт праграмы</string> <string name="simulate_initial_startup">Імітаваць першы старт праграмы</string>
<string name="shared_string_qr_code">QR-код</string> <string name="shared_string_qr_code">QR-код</string>
<string name="map_downloaded">Мапа сьцягнутая</string> <string name="map_downloaded">Мапа сьцягнутая</string>
<string name="poll">галасаваньне</string> <string name="feedback">галасаваньне</string>
</resources> </resources>

View file

@ -1979,7 +1979,7 @@
<string name="instalation_troubleshooting_item">Instalace a řešení problémů</string> <string name="instalation_troubleshooting_item">Instalace a řešení problémů</string>
<string name="techical_articles_item">Technické články</string> <string name="techical_articles_item">Technické články</string>
<string name="versions_item">Verze</string> <string name="versions_item">Verze</string>
<string name="poll">Anketa</string> <string name="feedback">Anketa</string>
<string name="contact_us">Kontaktujte nás</string> <string name="contact_us">Kontaktujte nás</string>
<string name="osm_edit_created_poi">Vytvořen OSM POI</string> <string name="osm_edit_created_poi">Vytvořen OSM POI</string>
<string name="osm_edit_created_bug">Vytvořena OSM chyba</string> <string name="osm_edit_created_bug">Vytvořena OSM chyba</string>

View file

@ -1998,7 +1998,7 @@
<string name="instalation_troubleshooting_item">Installation og fejlfinding</string> <string name="instalation_troubleshooting_item">Installation og fejlfinding</string>
<string name="techical_articles_item">Tekniske artikler</string> <string name="techical_articles_item">Tekniske artikler</string>
<string name="versions_item">Versioner</string> <string name="versions_item">Versioner</string>
<string name="poll">Meningsmåling</string> <string name="feedback">Meningsmåling</string>
<string name="contact_us">Kontakt os</string> <string name="contact_us">Kontakt os</string>
<string name="osm_edit_created_poi">Oprettede OSM IP</string> <string name="osm_edit_created_poi">Oprettede OSM IP</string>
<string name="osm_edit_created_bug">Oprettede OSM fejlregistrering</string> <string name="osm_edit_created_bug">Oprettede OSM fejlregistrering</string>

View file

@ -2011,7 +2011,7 @@
<string name="instalation_troubleshooting_item">Instalación y solución de problemas</string> <string name="instalation_troubleshooting_item">Instalación y solución de problemas</string>
<string name="techical_articles_item">Artículos técnicos</string> <string name="techical_articles_item">Artículos técnicos</string>
<string name="versions_item">Versiones</string> <string name="versions_item">Versiones</string>
<string name="poll">Encuesta</string> <string name="feedback">Encuesta</string>
<string name="contact_us">Contáctenos</string> <string name="contact_us">Contáctenos</string>
<string name="osm_edit_created_poi">PDI de OSM creado</string> <string name="osm_edit_created_poi">PDI de OSM creado</string>
<string name="osm_edit_created_bug">Reporte de OSM creado</string> <string name="osm_edit_created_bug">Reporte de OSM creado</string>

View file

@ -2131,7 +2131,7 @@
<string name="instalation_troubleshooting_item">Instalación y solución de problemas</string> <string name="instalation_troubleshooting_item">Instalación y solución de problemas</string>
<string name="techical_articles_item">Artículos técnicos</string> <string name="techical_articles_item">Artículos técnicos</string>
<string name="versions_item">Versiones</string> <string name="versions_item">Versiones</string>
<string name="poll">Encuesta</string> <string name="feedback">Encuesta</string>
<string name="contact_us">Contáctenos</string> <string name="contact_us">Contáctenos</string>
<string name="osm_edit_created_poi">PDI de OSM creado</string> <string name="osm_edit_created_poi">PDI de OSM creado</string>
<string name="osm_edit_created_bug">Nota de OSM creada</string> <string name="osm_edit_created_bug">Nota de OSM creada</string>

View file

@ -2071,7 +2071,7 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="instalation_troubleshooting_item">Installation et débogage</string> <string name="instalation_troubleshooting_item">Installation et débogage</string>
<string name="techical_articles_item">Articles techniques</string> <string name="techical_articles_item">Articles techniques</string>
<string name="versions_item">Versions</string> <string name="versions_item">Versions</string>
<string name="poll">Sondage</string> <string name="feedback">Sondage</string>
<string name="contact_us">Nous contacter</string> <string name="contact_us">Nous contacter</string>
<string name="osm_edit_created_poi">PI créés sur OSM</string> <string name="osm_edit_created_poi">PI créés sur OSM</string>

View file

@ -1982,6 +1982,6 @@
<string name="instalation_troubleshooting_item">Telepítés és hibaelhárítás</string> <string name="instalation_troubleshooting_item">Telepítés és hibaelhárítás</string>
<string name="techical_articles_item">Technikai cikkek</string> <string name="techical_articles_item">Technikai cikkek</string>
<string name="versions_item">Verziók</string> <string name="versions_item">Verziók</string>
<string name="poll">szavazás</string> <string name="feedback">szavazás</string>
<string name="contact_us">Kapcsolat</string> <string name="contact_us">Kapcsolat</string>
</resources> </resources>

View file

@ -1976,5 +1976,5 @@
<string name="audio_video_note_item">Garso/vaizdo pastabos</string> <string name="audio_video_note_item">Garso/vaizdo pastabos</string>
<string name="techical_articles_item">Techniniai straipsniai</string> <string name="techical_articles_item">Techniniai straipsniai</string>
<string name="poll">apklausa</string> <string name="feedback">apklausa</string>
</resources> </resources>

View file

@ -1986,7 +1986,7 @@
<string name="map_downloaded_descr">Карта %1$s загружена. Вернитесь к карте, чтобы начать её использовать.</string> <string name="map_downloaded_descr">Карта %1$s загружена. Вернитесь к карте, чтобы начать её использовать.</string>
<string name="simulate_initial_startup">Имитировать первый запуск</string> <string name="simulate_initial_startup">Имитировать первый запуск</string>
<string name="simulate_initial_startup_descr">Устанавливает признак первого запуска приложения, не изменяет других настроек</string> <string name="simulate_initial_startup_descr">Устанавливает признак первого запуска приложения, не изменяет других настроек</string>
<string name="poll">Опрос</string> <string name="feedback">Опрос</string>
<string name="contact_us">Связаться с нами</string> <string name="contact_us">Связаться с нами</string>
<string name="versions_item">Версии</string> <string name="versions_item">Версии</string>
<string name="techical_articles_item">Технические статьи</string> <string name="techical_articles_item">Технические статьи</string>

View file

@ -1971,7 +1971,7 @@
<string name="instalation_troubleshooting_item">Installatzione e solutziones a sos problemas</string> <string name="instalation_troubleshooting_item">Installatzione e solutziones a sos problemas</string>
<string name="techical_articles_item">Artìculos tècnicos</string> <string name="techical_articles_item">Artìculos tècnicos</string>
<string name="versions_item">Versiones</string> <string name="versions_item">Versiones</string>
<string name="poll">Sondàggiu</string> <string name="feedback">Sondàggiu</string>
<string name="contact_us">Cuntata·nos</string> <string name="contact_us">Cuntata·nos</string>
<string name="osm_edit_created_poi">PDI de OSM creadu</string> <string name="osm_edit_created_poi">PDI de OSM creadu</string>
<string name="osm_edit_created_bug">Nota de errore de OSM creada</string> <string name="osm_edit_created_bug">Nota de errore de OSM creada</string>

View file

@ -2139,6 +2139,6 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
<string name="instalation_troubleshooting_item">Inštalácia a riešenie problémov</string> <string name="instalation_troubleshooting_item">Inštalácia a riešenie problémov</string>
<string name="techical_articles_item">Technické články</string> <string name="techical_articles_item">Technické články</string>
<string name="versions_item">Verzie</string> <string name="versions_item">Verzie</string>
<string name="poll">Anketa</string> <string name="feedback">Anketa</string>
<string name="contact_us">Kontaktujte nás</string> <string name="contact_us">Kontaktujte nás</string>
</resources> </resources>

View file

@ -1971,7 +1971,7 @@
<string name="instalation_troubleshooting_item">Namestitev in odpravljanje napak</string> <string name="instalation_troubleshooting_item">Namestitev in odpravljanje napak</string>
<string name="techical_articles_item">Tehnični članki</string> <string name="techical_articles_item">Tehnični članki</string>
<string name="versions_item">Različice</string> <string name="versions_item">Različice</string>
<string name="poll">Anketa</string> <string name="feedback">Anketa</string>
<string name="contact_us">Stik z nami</string> <string name="contact_us">Stik z nami</string>
<string name="world_map_download_descr">Osnovni svetovni zemljevid (zemljevid sveta pri oddaljenem pogledu) je zastarel, ali pa ni nameščen. Brez tega zemljevida prikaz ni popoln.</string> <string name="world_map_download_descr">Osnovni svetovni zemljevid (zemljevid sveta pri oddaljenem pogledu) je zastarel, ali pa ni nameščen. Brez tega zemljevida prikaz ni popoln.</string>
<string name="simulate_initial_startup_descr">Nastavi zastavico, ki določa prvi zagon programa, ostale nastavitve pa ostanejo nespremenjene.</string> <string name="simulate_initial_startup_descr">Nastavi zastavico, ki določa prvi zagon programa, ostale nastavitve pa ostanejo nespremenjene.</string>

View file

@ -1956,7 +1956,7 @@
<string name="instalation_troubleshooting_item">安裝和疑難排除</string> <string name="instalation_troubleshooting_item">安裝和疑難排除</string>
<string name="techical_articles_item">技術文章</string> <string name="techical_articles_item">技術文章</string>
<string name="versions_item">版本</string> <string name="versions_item">版本</string>
<string name="poll">投票</string> <string name="feedback">投票</string>
<string name="contact_us">聯絡我們</string> <string name="contact_us">聯絡我們</string>
<string name="osm_edit_created_poi">建立 OSM 的興趣點</string> <string name="osm_edit_created_poi">建立 OSM 的興趣點</string>
<string name="osm_edit_created_bug">建立 OSM 的錯誤</string> <string name="osm_edit_created_bug">建立 OSM 的錯誤</string>

View file

@ -2050,7 +2050,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="instalation_troubleshooting_item">Installation and troubleshooting</string> <string name="instalation_troubleshooting_item">Installation and troubleshooting</string>
<string name="techical_articles_item">Technical articles</string> <string name="techical_articles_item">Technical articles</string>
<string name="versions_item">Versions</string> <string name="versions_item">Versions</string>
<string name="poll">Poll</string> <string name="feedback">Feedback</string>
<string name="contact_us">Contact us</string> <string name="contact_us">Contact us</string>
<string name="map_legend">Map legend</string> <string name="map_legend">Map legend</string>
</resources> </resources>

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 = "http://osmand.net/changes-2.1.html"; public static final String LATEST_CHANGES_URL = "http://osmand.net/help/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

@ -9,6 +9,7 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -25,7 +26,8 @@ import java.io.InputStreamReader;
public class HelpArticleDialogFragment extends DialogFragment { public class HelpArticleDialogFragment extends DialogFragment {
private static final Log LOG = PlatformUtil.getLog(HelpArticleDialogFragment.class); private static final Log LOG = PlatformUtil.getLog(HelpArticleDialogFragment.class);
public static final String FILE_NAME = "url"; private static final String ASSET_NAME = "asset_name";
private static final String URL = "url";
private WebView webView; private WebView webView;
@Override @Override
@ -51,13 +53,37 @@ public class HelpArticleDialogFragment extends DialogFragment {
} }
}); });
String fileContents = getAssetAsString(getArguments().getString(FILE_NAME), getActivity()); String assetName = getArguments().getString(ASSET_NAME);
String url = getArguments().getString(URL);
webView = (WebView) view.findViewById(R.id.webView); webView = (WebView) view.findViewById(R.id.webView);
if (assetName != null) {
if (savedInstanceState != null) { if (savedInstanceState != null) {
webView.restoreState(savedInstanceState); webView.restoreState(savedInstanceState);
} else { } else {
String fileContents = getAssetAsString(assetName, getActivity());
// fileContents = "<HTML><HEAD><LINK href=\"site.css\" " +
// "type=\"text/css\" rel=\"stylesheet\"/></HEAD><body>"
// + fileContents;
webView.loadDataWithBaseURL("http://osmand.net", fileContents, null, "utf-8", null); webView.loadDataWithBaseURL("http://osmand.net", fileContents, null, "utf-8", null);
} }
} else if (url != null) {
if (savedInstanceState != null) {
webView.restoreState(savedInstanceState);
} else {
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl(url);
}
} else {
throw new IllegalArgumentException("HelpArticleDialogFragment should be " +
"instantiated either with ASSET_NAME or with URL");
}
return view; return view;
} }
@ -70,9 +96,17 @@ public class HelpArticleDialogFragment extends DialogFragment {
return (OsmandApplication) getActivity().getApplication(); return (OsmandApplication) getActivity().getApplication();
} }
public static HelpArticleDialogFragment createInstance(String fileName) { public static HelpArticleDialogFragment instantiateWithAsset(String assetName) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(FILE_NAME, fileName); args.putString(ASSET_NAME, assetName);
final HelpArticleDialogFragment helpArticleDialogFragment = new HelpArticleDialogFragment();
helpArticleDialogFragment.setArguments(args);
return helpArticleDialogFragment;
}
public static HelpArticleDialogFragment instantiateWithUrl(String url) {
Bundle args = new Bundle();
args.putString(URL, url);
final HelpArticleDialogFragment helpArticleDialogFragment = new HelpArticleDialogFragment(); final HelpArticleDialogFragment helpArticleDialogFragment = new HelpArticleDialogFragment();
helpArticleDialogFragment.setArguments(args); helpArticleDialogFragment.setArguments(args);
return helpArticleDialogFragment; return helpArticleDialogFragment;

View file

@ -5,31 +5,31 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
public class MyMenuItem { public class HelpMenuItem {
private final String 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(String title) { public HelpMenuItem(String title) {
this(title, null); this(title, null);
} }
public MyMenuItem(@StringRes int title, Context context) { public HelpMenuItem(@StringRes int title, Context context) {
this(context.getString(title)); this(context.getString(title));
} }
public MyMenuItem(String title, OnClickListener onClickListener) { public HelpMenuItem(String title, OnClickListener onClickListener) {
this(title, null, -1, onClickListener); this(title, null, -1, onClickListener);
} }
private MyMenuItem(String title, @StringRes int desription, @DrawableRes int icon, private HelpMenuItem(String title, @StringRes int desription, @DrawableRes int icon,
Context context, OnClickListener onClickListener) { Context context, OnClickListener onClickListener) {
this(title, context.getString(desription), icon, onClickListener); this(title, context.getString(desription), icon, onClickListener);
} }
private MyMenuItem(String title, String desription, @DrawableRes int icon, private HelpMenuItem(String title, String desription, @DrawableRes int icon,
OnClickListener onClickListener) { OnClickListener onClickListener) {
this.title = title; this.title = title;
this.desription = desription; this.desription = desription;
@ -97,8 +97,8 @@ public class MyMenuItem {
return this; return this;
} }
public MyMenuItem create() { public HelpMenuItem create() {
return new MyMenuItem(title, description, icon, listener); return new HelpMenuItem(title, description, icon, listener);
} }
} }
} }

View file

@ -1,6 +1,5 @@
package net.osmand.plus.dialogs.helpscreen; package net.osmand.plus.dialogs.helpscreen;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -92,15 +91,15 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
public static class HelpAdapter extends OsmandBaseExpandableListAdapter { public static class HelpAdapter extends OsmandBaseExpandableListAdapter {
private final OsmandApplication ctx; private final OsmandApplication ctx;
private final Activity activity; private final FragmentActivity activity;
public HelpAdapter(Activity activity) { public HelpAdapter(FragmentActivity activity) {
this.ctx = (OsmandApplication) activity.getApplication(); this.ctx = (OsmandApplication) activity.getApplication();
this.activity = activity; this.activity = activity;
} }
@Override @Override
public MyMenuItem getChild(int groupPosition, int childPosition) { public HelpMenuItem getChild(int groupPosition, int childPosition) {
if (categories[groupPosition] != MenuCategory.HELP_US_TO_IMPROVE) { if (categories[groupPosition] != MenuCategory.HELP_US_TO_IMPROVE) {
return categories[groupPosition].getItem(childPosition); return categories[groupPosition].getItem(childPosition);
} else { } else {
@ -119,15 +118,14 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
if (categories[groupPosition] == MenuCategory.HELP_US_TO_IMPROVE) { if (categories[groupPosition] == MenuCategory.HELP_US_TO_IMPROVE) {
convertView = LayoutInflater.from(parent.getContext()).inflate( convertView = LayoutInflater.from(parent.getContext()).inflate(
R.layout.help_to_improve_item, parent, false); R.layout.help_to_improve_item, parent, false);
TextView pollButton = (TextView) convertView.findViewById(R.id.pollButton); TextView feedbackButton = (TextView) convertView.findViewById(R.id.feedbackButton);
Drawable pollIcon = ctx.getIconsCache().getContentIcon(R.drawable.ic_action_message); Drawable pollIcon = ctx.getIconsCache().getContentIcon(R.drawable.ic_action_message);
pollButton.setCompoundDrawablesWithIntrinsicBounds(null, pollIcon, null, null); feedbackButton.setCompoundDrawablesWithIntrinsicBounds(null, pollIcon, null, null);
pollButton.setOnClickListener(new View.OnClickListener() { feedbackButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent i = new Intent(Intent.ACTION_VIEW); HelpArticleDialogFragment.instantiateWithUrl(OSMAND_POLL_HTML)
i.setData(Uri.parse(OSMAND_POLL_HTML)); .show(activity.getSupportFragmentManager(), null);
activity.startActivity(i);
} }
}); });
TextView contactUsButton = (TextView) convertView.findViewById(R.id.contactUsButton); TextView contactUsButton = (TextView) convertView.findViewById(R.id.contactUsButton);
@ -149,7 +147,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
}); });
return convertView; return convertView;
} else { } else {
final MyMenuItem child = getChild(groupPosition, childPosition); final HelpMenuItem child = getChild(groupPosition, childPosition);
MenuItemViewHolder viewHolder; MenuItemViewHolder viewHolder;
if (convertView == null || convertView.getTag() == null) { if (convertView == null || convertView.getTag() == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate( convertView = LayoutInflater.from(parent.getContext()).inflate(
@ -235,7 +233,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
nameTextView = (TextView) view.findViewById(R.id.name); nameTextView = (TextView) view.findViewById(R.id.name);
} }
public void bindMenuItem(MyMenuItem menuItem) { public void bindMenuItem(HelpMenuItem menuItem) {
nameTextView.setText(menuItem.getTitle()); nameTextView.setText(menuItem.getTitle());
if (menuItem.getDesription() != null) { if (menuItem.getDesription() != null) {
descrTextView.setVisibility(View.VISIBLE); descrTextView.setVisibility(View.VISIBLE);
@ -260,7 +258,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
HELP_US_TO_IMPROVE(R.string.help_us_to_improve_menu_group), HELP_US_TO_IMPROVE(R.string.help_us_to_improve_menu_group),
OTHER(R.string.other_menu_group); OTHER(R.string.other_menu_group);
private List<MyMenuItem> items; private List<HelpMenuItem> items;
@StringRes @StringRes
private final int title; private final int title;
@ -276,34 +274,34 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
return items.size(); return items.size();
} }
public MyMenuItem getItem(int position) { public HelpMenuItem getItem(int position) {
return items.get(position); return items.get(position);
} }
public void initItems(List<MyMenuItem> items) { public void initItems(List<HelpMenuItem> items) {
this.items = items; this.items = items;
} }
} }
private List<MyMenuItem> createBeginWithOsmandItems() { private List<HelpMenuItem> createBeginWithOsmandItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<HelpMenuItem> arrayList = new ArrayList<>();
ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener( ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener(
"feature_articles/start.html", getActivity()); "feature_articles/start.html", getActivity());
MyMenuItem.Builder builder = new MyMenuItem.Builder() HelpMenuItem.Builder builder = new HelpMenuItem.Builder()
.setTitle(R.string.first_usage_item, getActivity()) .setTitle(R.string.first_usage_item, getActivity())
.setDescription(R.string.first_usage_item_description, getActivity()) .setDescription(R.string.first_usage_item_description, getActivity())
.setListener(listener); .setListener(listener);
arrayList.add(builder.create()); arrayList.add(builder.create());
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/navigation.html", getActivity()); "feature_articles/navigation.html", getActivity());
builder = new MyMenuItem.Builder() builder = new HelpMenuItem.Builder()
.setTitle(R.string.shared_string_navigation, getActivity()) .setTitle(R.string.shared_string_navigation, getActivity())
.setDescription(R.string.navigation_item_description, getActivity()) .setDescription(R.string.navigation_item_description, getActivity())
.setListener(listener); .setListener(listener);
arrayList.add(builder.create()); arrayList.add(builder.create());
listener = new ShowArticleOnTouchListener("feature_articles/faq.html", getActivity()); listener = new ShowArticleOnTouchListener("feature_articles/faq.html", getActivity());
builder = new MyMenuItem.Builder() builder = new HelpMenuItem.Builder()
.setTitle(R.string.faq_item, getActivity()) .setTitle(R.string.faq_item, getActivity())
.setDescription(R.string.faq_item_description, getActivity()) .setDescription(R.string.faq_item_description, getActivity())
.setListener(listener); .setListener(listener);
@ -311,36 +309,35 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
return arrayList; return arrayList;
} }
private List<MyMenuItem> createFeaturesItems() { private List<HelpMenuItem> createFeaturesItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<HelpMenuItem> arrayList = new ArrayList<>();
String name = getActivity().getString(R.string.map_viewing_item); String name = getActivity().getString(R.string.map_viewing_item);
ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener( ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener(
"feature_articles/map-viewing.html", getActivity()); "feature_articles/map-viewing.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
name = getActivity().getString(R.string.search_on_the_map_item); name = getActivity().getString(R.string.search_on_the_map_item);
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/find-something-on-map.html", getActivity()); "feature_articles/find-something-on-map.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
name = getActivity().getString(R.string.planning_trip_item); name = getActivity().getString(R.string.planning_trip_item);
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/trip-planning.html", getActivity()); "feature_articles/trip-planning.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
name = getActivity().getString(R.string.map_legend); name = getActivity().getString(R.string.map_legend);
View.OnClickListener onClickListener = new View.OnClickListener() { View.OnClickListener onClickListener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent i = new Intent(Intent.ACTION_VIEW); HelpArticleDialogFragment.instantiateWithUrl(OSMAND_MAP_LEGEND)
i.setData(Uri.parse(OSMAND_MAP_LEGEND)); .show(getFragmentManager(), null);
getActivity().startActivity(i);
} }
}; };
arrayList.add(new MyMenuItem(name, onClickListener)); arrayList.add(new HelpMenuItem(name, onClickListener));
return arrayList; return arrayList;
} }
private List<MyMenuItem> createPluginsItems() { private List<HelpMenuItem> createPluginsItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<HelpMenuItem> arrayList = new ArrayList<>();
MyMenuItem.Builder builder = new MyMenuItem.Builder(); HelpMenuItem.Builder builder = new HelpMenuItem.Builder();
for (final OsmandPlugin osmandPlugin : OsmandPlugin.getAvailablePlugins()) { for (final OsmandPlugin osmandPlugin : OsmandPlugin.getAvailablePlugins()) {
builder.reset(); builder.reset();
builder.setTitle(osmandPlugin.getName()) builder.setTitle(osmandPlugin.getName())
@ -354,21 +351,21 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
return arrayList; return arrayList;
} }
private List<MyMenuItem> createOtherItems() { private List<HelpMenuItem> createOtherItems() {
ArrayList<MyMenuItem> arrayList = new ArrayList<>(); ArrayList<HelpMenuItem> arrayList = new ArrayList<>();
String name = getActivity().getString(R.string.instalation_troubleshooting_item); String name = getActivity().getString(R.string.instalation_troubleshooting_item);
ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener( ShowArticleOnTouchListener listener = new ShowArticleOnTouchListener(
"feature_articles/installation-and-troubleshooting.html", getActivity()); "feature_articles/installation-and-troubleshooting.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
name = getActivity().getString(R.string.techical_articles_item); name = getActivity().getString(R.string.techical_articles_item);
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/TechnicalArticles.html", getActivity()); "feature_articles/TechnicalArticles.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
name = getActivity().getString(R.string.versions_item); name = getActivity().getString(R.string.versions_item);
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/changes.html", getActivity()); "feature_articles/changes.html", getActivity());
arrayList.add(new MyMenuItem(name, listener)); arrayList.add(new HelpMenuItem(name, listener));
String releasedate = ""; String releasedate = "";
if (!this.getString(R.string.app_edition).equals("")) { if (!this.getString(R.string.app_edition).equals("")) {
@ -377,7 +374,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
String version = Version.getFullVersion(getOsmandApplication()) + " " + releasedate; String version = Version.getFullVersion(getOsmandApplication()) + " " + releasedate;
listener = new ShowArticleOnTouchListener( listener = new ShowArticleOnTouchListener(
"feature_articles/about.html", getActivity()); "feature_articles/about.html", getActivity());
MyMenuItem.Builder builder = new MyMenuItem.Builder() HelpMenuItem.Builder builder = new HelpMenuItem.Builder()
.setTitle(R.string.shared_string_about, getActivity()) .setTitle(R.string.shared_string_about, getActivity())
.setDescription(version) .setDescription(version)
.setListener(listener); .setListener(listener);
@ -397,7 +394,7 @@ public class HelpScreenDialogFragment extends DialogFragment implements Expandab
@Override @Override
public void onClick(View v) { public void onClick(View v) {
HelpArticleDialogFragment.createInstance(filename) HelpArticleDialogFragment.instantiateWithAsset(filename)
.show(ctx.getSupportFragmentManager(), null); .show(ctx.getSupportFragmentManager(), null);
} }
} }