This commit is contained in:
Alexey Kulish 2015-09-10 16:51:05 +03:00
commit 7bacf18b10
11 changed files with 82 additions and 59 deletions

View file

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/bg_color"
android:background="?attr/spinnerListBackground"
android:clickable="true"
android:orientation="vertical"
tools:context="net.osmand.plus.osmedit.EditPoiFragment">
@ -97,7 +97,7 @@
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/pstsTabBackground"
android:background="?attr/bg_color"
app:layout_scrollFlags="scroll"
app:tabIndicatorColor="?attr/pstsIndicatorColor"
app:tabSelectedTextColor="?attr/pstsIndicatorColor"
@ -117,7 +117,7 @@
android:id="@+id/buttonDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:layout_width="fill_parent"
@ -131,7 +131,6 @@
android:height="48dp"
android:gravity="center"
android:text="@string/shared_string_cancel"
android:textColor="@color/dashboard_general_button_text_light"
app:textAllCapsCompat="true"/>
<net.osmand.plus.widgets.ButtonEx
@ -139,7 +138,6 @@
style="@style/DashboardGeneralButton"
android:height="48dp"
android:gravity="center"
android:textColor="@color/dashboard_general_button_text_light"
app:textAllCapsCompat="true"
tools:text="Save"/>
</LinearLayout>

View file

@ -40,7 +40,7 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/divider_color"/>
android:background="?attr/dashboard_divider"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/nameTextView"
@ -57,7 +57,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:layout_width="match_parent"
@ -78,7 +78,7 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/divider_color"/>
android:background="?attr/dashboard_divider"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/amenityTextView"

View file

@ -9,7 +9,7 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@attr/new_app_theme">
osmand:theme="?attr/new_app_theme">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/contactInfoTextView"
@ -124,7 +124,7 @@
android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_medium"/>
<!--XXX due to bug in NestedScroolView-->
<!--XXX due to bug in NestedScrollView-->
<Space
android:layout_width="match_parent"
android:layout_height="500dp"

View file

@ -32,7 +32,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?android:textColorSecondary"/>
</LinearLayout>
<LinearLayout
@ -59,13 +59,13 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?android:textColorSecondary"/>
</LinearLayout>
<View
android:layout_width="16dp"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?android:textColorSecondary"/>
<LinearLayout
android:layout_width="wrap_content"
@ -84,7 +84,7 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_color"/>
android:background="?android:textColorSecondary"/>
</LinearLayout>
</LinearLayout>

View file

@ -843,7 +843,7 @@
<string name="poi_error_unexpected_template">Произошла неожиданная ошибка при выполнении действия {0}.</string>
<string name="poi_error_io_error_template">Произошла ошибка ввода/вывода при выполнении действия {0}.</string>
<string name="poi_error_info_not_loaded">Произошла ошибка при загрузке информации о POI</string>
<string name="poi_dialog_name">Имя</string>
<string name="poi_dialog_name">Название</string>
<string name="poi_dialog_opening_hours">Время работы</string>
<string name="poi_dialog_comment">Комментарий</string>
<string name="poi_dialog_comment_default">Изменение POI</string>

View file

@ -2260,4 +2260,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="working_days">Working days</string>
<string name="recent_places">Recent places</string>
<string name="favourites">Favourites</string>
<string name="saved_at_time">Successfully saved at: %1$s</string>
</resources>

View file

@ -131,21 +131,17 @@
</style>
<style name="OsmandDarkTheme.DarkActionbar">
<item name="android:textColorPrimary">@color/color_white</item>
<item name="android:textColorSecondary">@color/inactive_item_orange</item>
<item name="android:textColorHint">@color/inactive_item_orange</item>
<item name="colorAccent">@color/color_white</item>
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
<item name="android:textColorSecondary">@color/dash_search_icon_dark</item>
</style>
<style name="OsmandDarkTheme.Toolbar">
<item name="android:textColorPrimary">@color/color_white</item>
<item name="android:textColorSecondary">@color/color_white</item>
<item name="android:textColorSecondary">@color/dash_search_icon_dark</item>
</style>
<style name="OsmandDarkTheme.NewAppTheme">
<item name="android:textColorSecondary">@color/dash_search_icon_dark</item>
<item name="colorAccent">@color/osmand_orange</item>
<item name="android:textColorSecondary">@color/divider_color</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
@ -186,7 +182,7 @@
<item name="android:textColorPrimary">@color/color_white</item>
<item name="spinnerItemTextColor">@color/color_white</item>
<item name="spinnerListBackground">@color/spinner_list_background_dark</item>
<item name="colorButtonNormal">@color/bg_color_dark</item>
<item name="colorButtonNormal">@color/actionbar_dark_color</item>
<item name="android:actionModeBackground">@color/actionbar_dark_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>

View file

@ -45,6 +45,8 @@ import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import gnu.trove.list.array.TIntArrayList;
@ -325,6 +327,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
SavingTrackHelper helper = app.getSavingTrackHelper();
helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
helper.close();
DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(app);
final String formattedTime =
timeFormat.format(new Date(helper.getLastTimeUpdated()));
showNotification(app, String.format(app.getString(R.string.saved_at_time),
formattedTime));
} finally {
isSaving = false;
}
@ -345,7 +352,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
}
}
public void startGPXMonitoring(Activity map) {
public void startGPXMonitoring(final Activity map) {
final ValueHolder<Integer> vs = new ValueHolder<Integer>();
final ValueHolder<Boolean> choice = new ValueHolder<Boolean>();
vs.value = settings.SAVE_GLOBAL_TRACK_INTERVAL.get();
@ -364,7 +371,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
settings.SERVICE_OFF_INTERVAL.set(settings.SAVE_GLOBAL_TRACK_INTERVAL.get());
}
app.startNavigationService(NavigationService.USED_BY_GPX);
app.startNavigationService(NavigationService.USED_BY_GPX);
showNotification(map, null);
}
};
if(choice.value) {
@ -379,38 +390,32 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
}
});
}
}
String stop = map.getResources().getString(R.string.shared_string_control_stop);
private static void showNotification(Context context, String contentText) {
String stop = context.getResources().getString(R.string.shared_string_control_stop);
Intent stopIntent = new Intent(NavigationService.OSMAND_STOP_SERVICE_ACTION);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(map, 0, stopIntent,
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
String save = map.getResources().getString(R.string.shared_string_save);
String save = context.getResources().getString(R.string.shared_string_save);
Intent saveIntent = new Intent(OSMAND_SAVE_SERVICE_ACTION);
PendingIntent savePendingIntent = PendingIntent.getBroadcast(map, 0, saveIntent,
PendingIntent savePendingIntent = PendingIntent.getBroadcast(context, 0, saveIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
BroadcastReceiver saveBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final OsmandMonitoringPlugin plugin = OsmandPlugin
.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.saveCurrentTrack();
}
}
};
map.registerReceiver(saveBroadcastReceiver, new IntentFilter(OSMAND_SAVE_SERVICE_ACTION));
BroadcastReceiver saveBroadcastReceiver = new SaveBroadcastReceiver();
context.registerReceiver(saveBroadcastReceiver, new IntentFilter(OSMAND_SAVE_SERVICE_ACTION));
final NotificationCompat.Builder notificationBuilder =
new android.support.v7.app.NotificationCompat.Builder(map)
.setContentTitle(map.getResources().getString(R.string.map_widget_monitoring))
.setSmallIcon(R.drawable.ic_action_polygom_dark)
new android.support.v7.app.NotificationCompat.Builder(context)
.setContentTitle(context.getResources().getString(R.string.map_widget_monitoring))
.setContentText(contentText)
.setSmallIcon(R.drawable.ic_action_polygom_dark)
// .setLargeIcon(Helpers.getBitmap(R.drawable.mirakel, getBaseContext()))
.setOngoing(true)
.addAction(R.drawable.ic_action_rec_stop, stop, stopPendingIntent)
.addAction(R.drawable.ic_action_save, save, savePendingIntent);
.setOngoing(true)
.addAction(R.drawable.ic_action_rec_stop, stop, stopPendingIntent)
.addAction(R.drawable.ic_action_save, save, savePendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) map.getSystemService(Context.NOTIFICATION_SERVICE);
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(notificationId, notificationBuilder.build());
}
@ -513,4 +518,15 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
return new DashFragmentData(DashTrackFragment.TAG, DashTrackFragment.class,
R.string.record_plugin_name, 11);
}
private static class SaveBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
final OsmandMonitoringPlugin plugin = OsmandPlugin
.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.saveCurrentTrack();
}
}
}
}

View file

@ -56,7 +56,7 @@ public class AdvancedDataFragment extends Fragment {
deleteDrawable = ((OsmandApplication) getActivity().getApplication()).getIconsCache()
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
getActivity().getResources().getColor(R.color.icon_color_light));
getActivity().getResources().getColor(R.color.dash_search_icon_dark));
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
TextView amenityTagTextView = (TextView) view.findViewById(R.id.amenityTagTextView);
TextView amenityTextView = (TextView) view.findViewById(R.id.amenityTextView);

View file

@ -52,21 +52,29 @@ public class BasicDataFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
IconsCache iconsCache = ((OsmandApplication) getActivity().getApplication()).getIconsCache();
View view = inflater.inflate(R.layout.fragment_edit_poi_normal, container, false);
IconsCache iconsCache = getMyApplication().getIconsCache();
int iconColor = getResources().getColor(R.color.dash_search_icon_dark);
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
streetImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_street_name));
streetImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
houseNumberImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_building_number));
houseNumberImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
phoneImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_call_dark));
phoneImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
webSiteImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_world_globe_dark));
webSiteImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
descriptionImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_description));
descriptionImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
ImageView openingHoursImageView = (ImageView) view.findViewById(R.id.openingHoursImageView);
openingHoursImageView.setImageDrawable(iconsCache.getContentIcon(R.drawable.ic_action_time));
openingHoursImageView.setImageDrawable(
iconsCache.getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
streetEditText.addTextChangedListener(new MyOnFocusChangeListener(getData(),
@ -96,10 +104,10 @@ public class BasicDataFragment extends Fragment {
}
});
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
Drawable clockDrawable = iconsCache.getContentIcon(R.drawable.ic_action_time);
Drawable clockDrawable = iconsCache
.getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
Drawable deleteDrawable = iconsCache
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
getActivity().getResources().getColor(R.color.icon_color_light));
.getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
mOpeningHoursAdapter = new OpeningHoursAdapter(
(OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS),
@ -112,6 +120,10 @@ public class BasicDataFragment extends Fragment {
return view;
}
private OsmandApplication getMyApplication() {
return (OsmandApplication) getActivity().getApplication();
}
@Override
public void onResume() {
super.onResume();

View file

@ -200,7 +200,7 @@ public class EditPoiFragment extends DialogFragment {
onlineDocumentationButton.setImageDrawable(
getMyApplication().getIconsCache()
.getPaintedContentIcon(R.drawable.ic_action_help,
getResources().getColor(R.color.inactive_item_orange)));
getResources().getColor(R.color.dash_search_icon_dark)));
final ImageButton poiTypeButton = (ImageButton) view.findViewById(R.id.poiTypeButton);
poiTypeButton.setOnClickListener(new View.OnClickListener() {
@Override