Update css & contents bottom

This commit is contained in:
Victor Shcherb 2018-04-15 15:07:08 +02:00
parent 3a1b3e50f2
commit 6086a3e7e1
7 changed files with 79 additions and 16 deletions

View file

@ -52,6 +52,7 @@ public class IndexConstants {
public static final String GPX_INDEX_DIR = "tracks/";
public static final String GPX_RECORDED_INDEX_DIR = GPX_INDEX_DIR + "rec/";
public static final String GPX_IMPORT_DIR = GPX_INDEX_DIR + "import/";
public static final String TILES_INDEX_DIR= "tiles/";
public static final String LIVE_INDEX_DIR= "live/";
public static final String TOURS_INDEX_DIR= "tours/";
@ -59,6 +60,7 @@ public class IndexConstants {
public static final String ROADS_INDEX_DIR = "roads/"; //$NON-NLS-1$
public static final String WIKI_INDEX_DIR = "wiki/"; //$NON-NLS-1$
public static final String WIKIVOYAGE_INDEX_DIR = "travel/";
public static final String GPX_TRAVEL_DIR = GPX_INDEX_DIR + WIKIVOYAGE_INDEX_DIR;
public static final String AV_INDEX_DIR = "avnotes/"; //$NON-NLS-1$
public static final String FONT_INDEX_DIR = "fonts/"; //$NON-NLS-1$
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$

View file

@ -33,11 +33,10 @@ h1 {
font-size: 2em;
color: #212121;
font-family: serif;
font-weight: bold;
letter-spacing: 0.03em;
word-wrap: break-word;
padding-top: 5%;
font-weight: normal;
}
h2 {
@ -47,6 +46,7 @@ h2 {
word-wrap: break-word;
margin-top: 3%;
margin-bottom: 3%;
font-weight: normal;
}
h2.active:after {

View file

@ -87,7 +87,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:layout_weight="0.33"
android:background="?attr/selectableItemBackground"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"
@ -105,13 +105,38 @@
tools:drawableLeft="@drawable/ic_action_list_header"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:ignore="UnusedAttribute" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/gpx_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0.33"
android:background="?attr/selectableItemBackground"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"
android:gravity="center_vertical"
android:letterSpacing="@dimen/text_button_letter_spacing"
android:maxLines="1"
android:paddingBottom="@dimen/context_menu_padding_margin_tiny"
android:paddingLeft="@dimen/bottom_sheet_content_margin"
android:paddingRight="@dimen/bottom_sheet_content_padding_small"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:text="@string/points"
android:textColor="?attr/wikivoyage_active_color"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:drawableLeft="@drawable/ic_action_track_16"
tools:drawableTint="?attr/wikivoyage_active_color"
tools:ignore="UnusedAttribute" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|end"
android:layout_weight="1"
android:layout_weight="0.34"
android:background="?attr/selectableItemBackground"
android:drawablePadding="@dimen/bottom_sheet_content_padding_small"
android:ellipsize="end"

View file

@ -7,7 +7,6 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.ColorInt;
import android.text.TextUtils;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.data.LocationPoint;
@ -1210,8 +1209,13 @@ public class GPXUtilities {
public static String writeGpxFile(File fout, GPXFile file, OsmandApplication ctx) {
Writer output = null;
try {
fout.getParentFile().mkdirs();
output = new OutputStreamWriter(new FileOutputStream(fout), "UTF-8"); //$NON-NLS-1$
return writeGpx(output, file, ctx);
String msg = writeGpx(output, file, ctx);
if(file.path == null) {
file.path = fout.getAbsolutePath();
}
return msg;
} catch (IOException e) {
log.error("Error saving gpx", e); //$NON-NLS-1$
return ctx.getString(R.string.error_occurred_saving_gpx);

View file

@ -449,14 +449,18 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
});
if (!MenuItemCompat.isActionViewExpanded(mi)) {
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(getGpxDataItem().getFile());
final boolean synced = markersHelper.isGroupSynced(markersGr.getId());
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers : R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
if (getGpx().path != null) {
final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final MapMarkersGroup markersGr = markersHelper.getOrCreateGroup(new File(getGpx().path));
final boolean synced = markersHelper.isGroupSynced(markersGr.getId());
createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers
: R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag_dark,
R.drawable.ic_action_flag_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
}
createMenuItem(menu, SELECT_FAVORITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_fav_dark,
R.drawable.ic_action_fav_dark, MenuItemCompat.SHOW_AS_ACTION_NEVER);
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark,

View file

@ -20,16 +20,17 @@ import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.myplaces.TrackPointFragment;
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
import net.osmand.util.Algorithms;
@ -154,6 +155,31 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
fragment.show(fm, WikivoyageArticleContentsFragment.TAG);
}
});
TextView trackButton = (TextView) mainView.findViewById(R.id.gpx_button);
trackButton.setCompoundDrawablesWithIntrinsicBounds(
getActiveIcon(R.drawable.ic_action_track_16), null, null, null
);
trackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fm = getFragmentManager();
if (article == null || fm == null) {
return;
}
File file = getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + article.getTitle() + ".gpx");
GPXFile gpx = article.getGpxFile();
GPXUtilities.writeGpxFile(file, gpx, getMyApplication());
Bundle args = new Bundle();
args.putString(WikivoyageArticleContentsFragment.CONTENTS_JSON_KEY, article.getContentsJson());
Intent newIntent = new Intent(getActivity(), getMyApplication().getAppCustomization().getTrackActivity());
newIntent.putExtra(TrackActivity.TRACK_FILE_NAME, gpx.path);
newIntent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(newIntent);
}
});
saveBtn = (TextView) mainView.findViewById(R.id.save_button);

View file

@ -2,18 +2,20 @@ package net.osmand.plus.wikivoyage.data;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import net.osmand.Collator;
import net.osmand.CollatorStringMatcher;
import net.osmand.CollatorStringMatcher.StringMatcherMode;
import net.osmand.IndexConstants;
import net.osmand.OsmAndCollator;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
import net.osmand.util.Algorithms;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -305,7 +307,7 @@ public class WikivoyageDbHelper {
res.lang = cursor.getString(10);
res.contentsJson = cursor.getString(11);
res.aggregatedPartOf = cursor.getString(12);
res.gpxFile = GPXUtilities.loadGPXFile(application, new ByteArrayInputStream(gpxFileBlob));
return res;
}