This commit is contained in:
Bars107 2015-01-22 16:01:58 +02:00
commit fbf52256cd
11 changed files with 393 additions and 4 deletions

View file

@ -16,7 +16,7 @@
android:text="@string/show_all"
style="@style/DashboardGeneralButton"/>
</LinearLayout>
<LinearLayout android:id="@+id/favorites"
<LinearLayout android:id="@+id/items"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="@dimen/dashListItemHeight">
<View android:layout_width="match_parent"
android:background="@color/dashboard_divider"
android:layout_height="1dp"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
android:layout_marginRight="@dimen/showAllButtonMarginRight"
android:layout_height="wrap_content">
<TextView android:id="@+id/name"
android:textColor="@color/dashboard_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:id="@+id/points_icon"
android:src="@drawable/ic_small_point"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/points_count"
android:textColor="@color/dashboard_descr_colol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/distance_icon"
android:src="@drawable/ic_small_distance"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/distance"
android:textColor="@color/dashboard_descr_colol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/time_icon"
android:src="@drawable/ic_small_time"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/time"
android:textColor="@color/dashboard_descr_colol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<ImageView android:id="@+id/stop"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/show_on_map"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/bg_cardui"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="@+id/header_layout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashHeaderHeight">
<TextView android:id="@+id/osmo_text"
android:text="@string/map_widget_av_notes"
style="@style/DashboardSubHeader"/>
<Button android:id="@+id/manage"
android:text="@string/show_all"
style="@style/DashboardGeneralButton"/>
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashHeaderHeight">
<TextView android:text="@string/my_location"
style="@style/DashboardSubHeader"
android:layout_weight="1"/>
<Button android:id="@+id/share"
android:text="@string/show_all"
style="@style/DashboardGeneralButton"/>
<include layout="@layout/check_item_rel" />
</LinearLayout>
<View android:background="@color/dashboard_divider"
android:layout_width="match_parent"
android:layout_height="1dp"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:id="@+id/points_icon"
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
android:src="@drawable/ic_small_point"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/points_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/distance_icon"
android:src="@drawable/ic_small_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/time_icon"
android:src="@drawable/ic_small_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/showAllButtonMarginRight"/>
</LinearLayout>
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:id="@+id/items"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="@dimen/dashListItemHeight">
<ImageView android:id="@+id/icon"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_marginRight="@dimen/dashFavIconMargin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:id="@+id/people_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/people_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<ImageButton android:id="@+id/show_on_map"
android:layout_marginLeft="@dimen/dashFavIconMargin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>

View file

@ -56,6 +56,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TracksFragment"
android:name="net.osmand.plus.dashboard.DashTrackFragment"
android:layout_marginTop="@dimen/dashCardMargin"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!--<fragment-->
<!--xmlns:android="http://schemas.android.com/apk/res/android"-->
<!--android:name="net.osmand.plus.dashboard.DashDownloadMapsFragment"-->
@ -63,6 +71,7 @@
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"/>-->
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/UpdateFragment"

View file

@ -13,6 +13,10 @@
<string name="proxy_pref_title">Proxy</string>
<string name="proxy_pref_descr">Setup a proxy internet communication</string>
<string name="settings_privacy">Privacy</string>
<string name="points">Points</string>
<string name="tracks">Tracks</string>
<string name="my_location">My location</string>
<string name="osm_editing_manage">Manage</string>
<string name="recents">RECENTS</string>
<string name="navigation_over_track">Start navigation over track?</string>
<string name="avoid_roads_msg">You can change route by selecting roads to avoid</string>

View file

@ -55,7 +55,7 @@ public class DashFavoritesFragment extends DashBaseFragment implements Favourite
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_favorites_fragment, container, false);
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
((TextView) view.findViewById(R.id.fav_text)).setTypeface(typeface);
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
@ -132,7 +132,7 @@ public class DashFavoritesFragment extends DashBaseFragment implements Favourite
return (dist - dist2);
}
});
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.favorites);
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
favorites.removeAllViews();
if (points.size() > 3){
while (points.size() != 3){

View file

@ -0,0 +1,58 @@
package net.osmand.plus.dashboard;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.osmedit.OsmEditingPlugin;
/**
* Created by Denis
* on 20.01.2015.
*/
public class DashOsmEditsFragment extends DashBaseFragment {
OsmEditingPlugin plugin;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_audio_video_notes_plugin, container, false);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
TextView header = ((TextView) view.findViewById(R.id.notes_text));
header.setTypeface(typeface);
header.setText(R.string.osm_settings);
Button manage = ((Button) view.findViewById(R.id.show_all));
manage.setTypeface(typeface);
manage.setText(R.string.osm_editing_manage);
return view;
}
@Override
public void onResume() {
super.onResume();
if (plugin == null) {
plugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
}
setupEditings();
}
private void setupEditings() {
View mainView = getView();
if (plugin == null){
mainView.setVisibility(View.GONE);
return;
}
}
}

View file

@ -0,0 +1,34 @@
package net.osmand.plus.dashboard;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.osmo.OsMoPlugin;
/**
* Created by Denis
* on 20.01.2015.
*/
public class DashOsmoFragment extends DashBaseFragment {
OsMoPlugin plugin;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_osmo_fragment, container, false);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
((TextView) view.findViewById(R.id.osmo_text)).setTypeface(typeface);
Button manage = (Button) view.findViewById(R.id.manage);
return view;
}
}

View file

@ -0,0 +1,97 @@
package net.osmand.plus.dashboard;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.osmand.IndexConstants;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.R;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.GpxUiHelper;
import java.io.File;
import java.util.List;
/**
* Created by Denis
* on 21.01.2015.
*/
public class DashTrackFragment extends DashBaseFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
Typeface typeface = FontCache.getRobotoMedium(getActivity());
TextView header = (TextView) view.findViewById(R.id.fav_text);
header.setTypeface(typeface);
header.setText(R.string.tracks);
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Activity activity = getActivity();
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(favorites);
}
});
return view;
}
@Override
public void onResume() {
super.onResume();
setupGpxFiles();
}
private void setupGpxFiles() {
View mainView = getView();
final File dir = getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR);
final List<String> list = GpxUiHelper.getSortedGPXFilenames(dir);
if (list.size() == 0){
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
return;
} else {
(mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE);
}
LinearLayout tracks = (LinearLayout) mainView.findViewById(R.id.items);
tracks.removeAllViews();
if (list.size() > 3){
while (list.size() != 3){
list.remove(3);
}
}
for (String filename : list){
final File f = new File(dir, filename);
GPXUtilities.GPXFile res = GPXUtilities.loadGPXFile(getMyApplication(), f);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
((TextView)view.findViewById(R.id.name)).setText(filename);
((TextView)view.findViewById(R.id.points_count)).
setText(res.points.size() + " " + getActivity().getString(R.string.points));
String description = GpxUiHelper.getDescription(getMyApplication(), res, f, true);
int startindex = description.indexOf(">");
int endindex = description.indexOf("</font>");
String distnace = description.substring(startindex + 1, endindex);
((TextView)view.findViewById(R.id.distance)).
setText(distnace);
view.findViewById(R.id.time_icon).setVisibility(View.GONE);
//view.findViewById(R.id.distance_icon).setVisibility(View.GONE);
tracks.addView(view);
}
}
}

View file

@ -389,7 +389,7 @@ public class GpxUiHelper {
}
}
}
private static List<String> getSortedGPXFilenames(File dir) {
public static List<String> getSortedGPXFilenames(File dir) {
return getSortedGPXFilenames(dir, null);
}