More help fixes. CSS is working. Merge.

This commit is contained in:
GaidamakUA 2015-11-03 18:43:38 +02:00
commit cf41fcbb50
12 changed files with 40 additions and 208 deletions

View file

@ -199,17 +199,14 @@ task collectFonts(type: Copy) {
}
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"
include "about.html"
}
from("../../help/website/feature_articles"){
include "*.html"

View file

@ -11,6 +11,7 @@
android:layout_height="wrap_content"
app:title="@string/shared_string_help"
app:navigationIcon="@drawable/abc_ic_ab_back_mtrl_am_alpha"
app:theme="?attr/toolbar_theme"
android:background="?attr/pstsTabBackground"/>
<ExpandableListView

View file

@ -7,13 +7,14 @@
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
<Button
android:id="@+id/feedbackButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/feedback"
style="@style/Widget.AppCompat.Button.Borderless"
tools:drawableTop="@drawable/ic_action_message"/>
<View
@ -21,13 +22,14 @@
android:layout_height="match_parent"
android:background="?attr/divider_color"/>
<TextView
<Button
android:id="@+id/contactUsButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/contact_us"
style="@style/Widget.AppCompat.Button.Borderless"
tools:drawableTop="@drawable/ic_action_message"/>
</LinearLayout>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="srtm_paid_version_msg">Overvej at købe Højdekurve udvidelsen (\'Contour lines\') på Google Play for at støtte den videre udvikling.</string>
<string name="av_def_action_video">Optag video</string>
@ -2002,4 +2002,5 @@
<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>
</resources>
<string name="map_legend">Kortforklaring</string>
</resources>

View file

@ -2031,4 +2031,6 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="versions_item">Versioni</string>
<string name="contact_us">Contattaci</string>
<string name="world_map_download_descr">La mappa di base (copertura mondiale a piccoli livelli di zoom) è mancante o non aggiornata. Valutate di scaricare la mappa mondiale di base per un ambiente completo.</string>
<string name="poll">Sondaggio</string>
<string name="map_legend">Legenda della mappa</string>
</resources>

View file

@ -962,4 +962,10 @@
<string name="poi_denomination_adventist">アドベンチスト・安息日再臨派(Adventist)</string>
<string name="poi_denomination_nazarene">ナザレン教会(Nazarene)</string>
<string name="poi_denomination_united_methodist">統一メソジスト教会(United methodist)</string>
<string name="poi_denomination_congregational">会衆派教会(Congregational)</string>
<string name="poi_denomination_old_believers">古儀式派(Old believers)</string>
<string name="poi_denomination_serbian_orthodox">セルビア正教会(Serbian orthodox)</string>
<string name="poi_denomination_spiritist">心霊主義(Spiritist)</string>
<string name="poi_denomination_armenian_apostolic">アルメニア教会(Armenian apostolic)</string>
<string name="poi_denomination_dutch_reformed">オランダ改革派(Dutch reformed)</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="starting_point_too_far">Pradžios taškas yra per toli nuo artimiausio kelio.</string>
<string name="shared_location">Bendrinta vieta</string>
@ -1962,7 +1962,7 @@
<string name="instalation_troubleshooting_item">Diegimas ir problemų sprendimas</string>
<string name="versions_item">Versijos</string>
<string name="contact_us">Susisiekti</string>
<string name="world_map_download_descr">Pasaulio žemėlapis (padengia visą pasauli stambiu masteliu) neįdiegtas arba pasenęs. Prašome atsisiųsti arba atnaujinti.</string>
<string name="world_map_download_descr">Pasaulio žemėlapis (padengiantis visą pasauli stambiu masteliu) neįdiegtas arba pasenęs. Prašome atsisiųsti arba atnaujinti.</string>
<string name="share_geo">geo:</string>
<string name="nm">nm</string>
<string name="shared_string_trip_recording">Kelionės įrašymas</string>
@ -1976,5 +1976,7 @@
<string name="audio_video_note_item">Garso/vaizdo pastabos</string>
<string name="techical_articles_item">Techniniai straipsniai</string>
<string name="feedback">apklausa</string>
</resources>
<string name="poll">apklausa</string>
<string name="osm_edit_created_poi"/>
<string name="osm_edit_created_bug">Sukurtas OSM riktas</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="always_center_position_on_map">Ammustra sa positzione semper a su tzentru</string>
<string name="voice_pref_title">Boghe</string>
@ -1975,4 +1975,5 @@
<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>
</resources>
<string name="map_legend">Legenda de sa mapa</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="rendering_attr_roadColors_description">選擇道路的色彩調配:</string>
<string name="rendering_attr_roadColors_name">道路的色彩調配</string>
@ -1960,4 +1960,5 @@
<string name="contact_us">聯絡我們</string>
<string name="osm_edit_created_poi">建立 OSM 的興趣點</string>
<string name="osm_edit_created_bug">建立 OSM 的錯誤</string>
</resources>
<string name="map_legend">地圖圖例</string>
</resources>

View file

@ -1,202 +1,19 @@
package net.osmand.plus.activities;
import android.annotation.SuppressLint;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.dialogs.helpscreen.HelpScreenDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class HelpActivity extends OsmandActionBarActivity {
private static final String FILE_ANDROID_ASSET_HELP = "file:///android_asset/help/";
public static final String URL = "url";
public static final String TITLE = "title";
private static final int HOME = 1;
private static final int BACK = 2;
private static final int FORWARD = 3;
private static final int CLOSE = 4;
private static final int NEW_VERSION = 5;
private WebView mWebView;
public static final String DIALOG = "dialog";
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
getMyApplication().applyTheme(this);
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
}
super.onCreate(savedInstanceState);
String title = getString(R.string.shared_string_help) + " (" + Version.getFullVersion(getMyApplication()) + ")";
String url = "index.html";
if (getIntent() != null) {
String tl = getIntent().getStringExtra(TITLE);
if (tl != null) {
title = tl;
}
String ul = getIntent().getStringExtra(URL);
if (ul != null) {
url = ul;
}
if (getSupportFragmentManager().findFragmentByTag(DIALOG) == null) {
new HelpScreenDialogFragment().show(getSupportFragmentManager(), DIALOG);
}
getSupportActionBar().setTitle(title);
setContentView(R.layout.help_activity);
mWebView = (WebView) findViewById(R.id.webView);
mWebView.setFocusable(true);
mWebView.setFocusableInTouchMode(true);
mWebView.requestFocus(View.FOCUS_DOWN);
mWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_UP:
if (!view.hasFocus()) {
view.requestFocus();
}
break;
}
return false;
}
});
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
mWebView.requestFocus(View.FOCUS_DOWN);
}
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
}
});
if (savedInstanceState != null) {
mWebView.restoreState(savedInstanceState);
} else {
mWebView.loadUrl(FILE_ANDROID_ASSET_HELP + url);
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
mWebView.saveState(outState);
super.onSaveInstanceState(outState);
}
public String readContent(String url) throws IOException {
InputStream index = HelpActivity.class.getClassLoader().getResourceAsStream("help/" + url);
BufferedReader read = new BufferedReader(new InputStreamReader(index));
StringBuilder bld = new StringBuilder();
String s;
while ((s = read.readLine()) != null) {
bld.append(s);
}
read.close();
return bld.toString();
}
private OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (AndroidUiHelper.isOrientationPortrait(this)) {
menu = getClearToolbar(true).getMenu();
} else {
getClearToolbar(false);
}
createMenuItem(menu, HOME, R.string.home,
R.drawable.ic_action_home_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, BACK, R.string.shared_string_previous,
R.drawable.ic_action_undo_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, FORWARD, R.string.shared_string_next,
R.drawable.ic_action_redo_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, CLOSE, R.string.shared_string_close,
R.drawable.ic_action_remove_dark,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
createMenuItem(menu, NEW_VERSION, R.string.new_version,
R.drawable.ic_action_help,
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
switch (itemId) {
case android.R.id.home:
finish();
return true;
case HOME:
mWebView.loadUrl(FILE_ANDROID_ASSET_HELP + "index.html");
return true;
case BACK:
if (mWebView.canGoBack()) {
mWebView.goBack();
}
return true;
case FORWARD:
if (mWebView.canGoForward()) {
mWebView.goForward();
}
return true;
case CLOSE:
finish();
return true;
case NEW_VERSION:
new HelpScreenDialogFragment().show(getSupportFragmentManager(), null);
return true;
}
return false;
}
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconDark, int menuItemType) {
MenuItem menuItem = m.add(0, id, 0, titleRes);
if (iconDark != 0) {
menuItem.setIcon(getMyApplication().getIconsCache().getIcon(iconDark));
}
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return onOptionsItemSelected(item);
}
});
return menuItem;
}
public Toolbar getClearToolbar(boolean visible) {
final Toolbar tb = (Toolbar) findViewById(R.id.bottomControls);
tb.setTitle(null);
tb.getMenu().clear();
tb.setVisibility(visible ? View.VISIBLE : View.GONE);
return tb;
}
}

View file

@ -61,11 +61,14 @@ public class HelpArticleDialogFragment extends DialogFragment {
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);
StringBuilder sb = new StringBuilder();
sb.append("<HTML><HEAD><LINK href=\"file:///android_asset/style.css\" " +
"type=\"text/css\" rel=\"stylesheet\"/></HEAD><body>");
sb.append(fileContents);
sb.append("</body></HTML>");
webView.loadDataWithBaseURL("http://osmand.net", sb.toString(), null, "utf-8", null);
}
} else if (url != null) {
if (savedInstanceState != null) {

View file

@ -11,7 +11,6 @@ import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
import net.osmand.plus.mapcontextmenu.MenuTitleController;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
import net.osmand.plus.views.OsmandMapLayer;
import java.util.Collections;
import java.util.Comparator;
@ -19,7 +18,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class MapMultiSelectionMenu extends BaseMenuController {
@ -172,6 +170,7 @@ public class MapMultiSelectionMenu extends BaseMenuController {
this.latLon = latLon;
createCollection(selectedObjects);
MapMultiSelectionMenuFragment.showInstance(getMapActivity());
getMapActivity().refreshMap();
}
public boolean isVisible() {