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

@ -140,15 +140,15 @@ android {
buildTypes {
debug {
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
// minifyEnabled true
// proguardFiles 'proguard-project.txt'
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
// minifyEnabled true
// proguardFiles 'proguard-project.txt'
signingConfig signingConfigs.development
}
release {
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
// minifyEnabled true
//proguardFiles 'proguard-project.txt'
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
// minifyEnabled true
//proguardFiles 'proguard-project.txt'
signingConfig signingConfigs.publishing
}
}
@ -198,24 +198,24 @@ task collectFonts(type: Copy) {
include "*.ttf"
}
task collectHelpContentsAssets(type: Sync) {
from "../../help/help"
into "assets/help"
include "*.html"
include "images/**/*.png"
task collectHelpContentsAssets(type: Copy) {
from("assets/") {
// include "style.css"
}
from("../../help/help-online") {
include "TechnicalArticles.html"
include "about.html"
}
from("../../help/help") {
include "faq.html"
include "osmo-plugin.html"
include "changes.html"
}
from("../../help/website/feature_articles"){
include "*.html"
}
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 "about.html"
}
task collectRoutingResources(type: Sync) {
@ -225,13 +225,13 @@ task collectRoutingResources(type: Sync) {
}
task collectMiscResources(type: Copy) {
into "src/net/osmand/osm"
from("../../resources/obf_creation") {
include "rendering_types.xml"
}
from("../../resources/poi") {
include "poi_types.xml"
}
into "src/net/osmand/osm"
from("../../resources/obf_creation") {
include "rendering_types.xml"
}
from("../../resources/poi") {
include "poi_types.xml"
}
}
task collectRenderingStylesResources(type: Sync) {
@ -302,7 +302,7 @@ tasks.withType(JavaCompile) {
clean.dependsOn 'cleanNoTranslate'
task cleanNoTranslate() {
delete ('res/values/no_translate.xml')
delete('res/values/no_translate.xml')
}
repositories {

View file

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

View file

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

View file

@ -1979,7 +1979,7 @@
<string name="instalation_troubleshooting_item">Instalace a řešení problémů</string>
<string name="techical_articles_item">Technické články</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="osm_edit_created_poi">Vytvořen OSM POI</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="techical_articles_item">Tekniske artikler</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="osm_edit_created_poi">Oprettede OSM IP</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="techical_articles_item">Artículos técnicos</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="osm_edit_created_poi">PDI 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="techical_articles_item">Artículos técnicos</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="osm_edit_created_poi">PDI de OSM creado</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="techical_articles_item">Articles techniques</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="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="techical_articles_item">Technikai cikkek</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>
</resources>

View file

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

View file

@ -1986,7 +1986,7 @@
<string name="map_downloaded_descr">Карта %1$s загружена. Вернитесь к карте, чтобы начать её использовать.</string>
<string name="simulate_initial_startup">Имитировать первый запуск</string>
<string name="simulate_initial_startup_descr">Устанавливает признак первого запуска приложения, не изменяет других настроек</string>
<string name="poll">Опрос</string>
<string name="feedback">Опрос</string>
<string name="contact_us">Связаться с нами</string>
<string name="versions_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="techical_articles_item">Artìculos tècnicos</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="osm_edit_created_poi">PDI de OSM creadu</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="techical_articles_item">Technické články</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>
</resources>

View file

@ -1971,7 +1971,7 @@
<string name="instalation_troubleshooting_item">Namestitev in odpravljanje napak</string>
<string name="techical_articles_item">Tehnični članki</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="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>

View file

@ -1956,7 +1956,7 @@
<string name="instalation_troubleshooting_item">安裝和疑難排除</string>
<string name="techical_articles_item">技術文章</string>
<string name="versions_item">版本</string>
<string name="poll">投票</string>
<string name="feedback">投票</string>
<string name="contact_us">聯絡我們</string>
<string name="osm_edit_created_poi">建立 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="techical_articles_item">Technical articles</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="map_legend">Map legend</string>
</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 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 String APP_EXIT_KEY = "APP_EXIT_KEY";
private OsmandApplication app;

View file

@ -9,6 +9,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
@ -25,7 +26,8 @@ import java.io.InputStreamReader;
public class HelpArticleDialogFragment extends DialogFragment {
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;
@Override
@ -51,12 +53,36 @@ 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);
if (savedInstanceState != null) {
webView.restoreState(savedInstanceState);
if (assetName != null) {
if (savedInstanceState != null) {
webView.restoreState(savedInstanceState);
} 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);
}
} 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 {
webView.loadDataWithBaseURL("http://osmand.net", fileContents, null, "utf-8", null);
throw new IllegalArgumentException("HelpArticleDialogFragment should be " +
"instantiated either with ASSET_NAME or with URL");
}
return view;
}
@ -70,9 +96,17 @@ public class HelpArticleDialogFragment extends DialogFragment {
return (OsmandApplication) getActivity().getApplication();
}
public static HelpArticleDialogFragment createInstance(String fileName) {
public static HelpArticleDialogFragment instantiateWithAsset(String assetName) {
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();
helpArticleDialogFragment.setArguments(args);
return helpArticleDialogFragment;

View file

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

View file

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