polishing Create poi design
This commit is contained in:
parent
daa5d72033
commit
e529003aa2
11 changed files with 144 additions and 53 deletions
|
@ -8,6 +8,15 @@
|
|||
android:orientation="vertical"
|
||||
tools:context="net.osmand.plus.osmedit.EditPoiFragment"
|
||||
android:clickable="true">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp"
|
||||
android:theme="@style/OsmandLightTheme.Toolbar"
|
||||
android:background="@color/osmand_orange"/>
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -19,16 +28,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/OsmandLightTheme.DarkActionbar">
|
||||
|
||||
<!-- TODO change theme -->
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
app:contentInsetLeft="72dp"
|
||||
app:contentInsetStart="72dp"
|
||||
app:layout_scrollFlags="scroll"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -38,8 +38,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp">
|
||||
android:layout_marginRight="16dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/poiNameEditText"
|
||||
|
@ -69,7 +68,6 @@
|
|||
android:id="@+id/poiTypeTextInputLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
|
@ -100,7 +98,8 @@
|
|||
android:background="@color/color_white"
|
||||
app:tabIndicatorColor="@color/osmand_orange"
|
||||
app:tabSelectedTextColor="@color/osmand_orange"
|
||||
app:tabTextColor="@android:color/darker_gray"/>
|
||||
app:tabTextColor="@android:color/darker_gray"
|
||||
app:layout_scrollFlags="scroll"/>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
||||
|
|
|
@ -3,44 +3,50 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto">
|
||||
android:theme="@style/OsmandLightTheme.NewAppTheme">
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<android.support.v7.widget.CardView
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/color_white"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
card_view:cardCornerRadius="2dp">
|
||||
android:background="@drawable/bg_card_shadow">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="name"
|
||||
android:layout_margin="16dp"/>
|
||||
android:layout_margin="16dp"
|
||||
android:text="name"/>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/divider_color"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
@ -50,16 +56,19 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amenityTagTextView"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="amenity"
|
||||
android:layout_margin="16dp"/>
|
||||
android:layout_margin="16dp"
|
||||
android:text="amenity"/>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/divider_color"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/amenityTextView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -67,7 +76,7 @@
|
|||
android:layout_margin="16dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/editTagsList"
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/OsmandLightTheme.NewAppTheme">
|
||||
|
||||
<TextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/contactInfoTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="Contact info"
|
||||
android:textColor="@color/color_black"/>
|
||||
android:textColor="@color/color_black"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/streetImageView"
|
||||
|
@ -40,7 +44,7 @@
|
|||
android:id="@+id/houseNumberEditText"
|
||||
style="@style/create_poi_text_field"
|
||||
android:layout_below="@id/streetEditText"
|
||||
android:hint="35"
|
||||
android:hint="@string/building_number"
|
||||
android:inputType="text"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -83,14 +87,15 @@
|
|||
android:hint="Description"
|
||||
android:inputType="textMultiLine"/>
|
||||
|
||||
<TextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/openHoursTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/descriptionEditText"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:text="Open hours"
|
||||
android:textColor="@color/color_black"/>
|
||||
android:textColor="@color/color_black"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/openHoursContainer"
|
||||
|
|
15
OsmAnd/res/layout/time_picker_dialog_title.xml
Normal file
15
OsmAnd/res/layout/time_picker_dialog_title.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="18dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -154,4 +154,6 @@
|
|||
<color name="inactive_iteme_orange">#ffc87f</color>
|
||||
<color name="osmand_orange_dark">#e68200</color>
|
||||
<color name="divider_color">#ccc</color>
|
||||
|
||||
<color name="color_dialog_buttons">#2f7af5</color>
|
||||
</resources>
|
|
@ -2240,4 +2240,10 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="app_name_osmand">OsmAnd</string>
|
||||
<string name="offline_maps_and_navigation"><![CDATA[Offline Maps\n& Navigation]]></string>
|
||||
<string name="commit_poi">Commit POI</string>
|
||||
<string name="basic_tab_title">Basic</string>
|
||||
<string name="extended_tab_title">Extended</string>
|
||||
<string name="building_number">Building Number</string>
|
||||
<string name="next_proceed">Next</string>
|
||||
<string name="opening_at">Opening at</string>
|
||||
<string name="closing_at">Closing at</string>
|
||||
</resources>
|
||||
|
|
|
@ -97,7 +97,6 @@
|
|||
|
||||
<item name="colorPrimary">@color/osmand_orange</item>
|
||||
<item name="colorPrimaryDark">@color/osmand_orange_dark</item>
|
||||
<!--<item name="colorAccent">@color/</item>-->
|
||||
|
||||
<item name="android:actionModeBackground">@color/actionbar_light_color</item>
|
||||
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
|
||||
|
@ -106,6 +105,34 @@
|
|||
<item name="android:actionMenuTextColor">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.DarkActionbar">
|
||||
<item name="android:textColorPrimary">@color/color_white</item>
|
||||
<item name="android:textColorSecondary">@color/inactive_iteme_orange</item>
|
||||
<item name="android:textColorHint">@color/inactive_iteme_orange</item>
|
||||
<item name="colorAccent">@color/accent_material_light</item>
|
||||
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.Toolbar">
|
||||
<item name="android:textColorPrimary">@color/color_white</item>
|
||||
<item name="android:textColorSecondary">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.NewAppTheme">
|
||||
<item name="colorAccent">@color/osmand_orange</item>
|
||||
<item name="android:textColorSecondary">@color/divider_color</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<item name="colorAccent">@color/osmand_orange</item>
|
||||
<item name="buttonBarButtonStyle">@style/DialogButtonLight</item>
|
||||
</style>
|
||||
|
||||
<style name="DialogButtonLight" parent="Base.Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:textColor">@color/color_dialog_buttons</item>
|
||||
<item name="android:textColorPrimary">@color/color_black</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
<item name="list_divider">@color/list_divider_light</item>
|
||||
<item name="expandable_category_color">?android:attr/colorBackground</item>
|
||||
|
@ -180,13 +207,6 @@
|
|||
<item name="android:textColor">@color/color_white</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.DarkActionbar">
|
||||
<item name="android:textColorPrimary">@color/color_white</item>
|
||||
<item name="android:textColorSecondary">@color/inactive_iteme_orange</item>
|
||||
<item name="android:textColorHint">@color/inactive_iteme_orange</item>
|
||||
<!--<item name="actionMenuTextColor">@color/color_white</item>-->
|
||||
</style>
|
||||
|
||||
<!-- Dialog popup -->
|
||||
<style name="Animations"/>
|
||||
<!-- PopDownMenu -->
|
||||
|
|
|
@ -620,7 +620,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
return true;
|
||||
} else if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) {
|
||||
dashboardOnMap.onMenuPressed();
|
||||
openDrawer();
|
||||
return true;
|
||||
} else if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) {
|
||||
Intent newIntent = new Intent(MapActivity.this, getMyApplication().getAppCustomization()
|
||||
|
|
|
@ -129,7 +129,9 @@ public class EditPoiFragment extends Fragment {
|
|||
});
|
||||
|
||||
viewPager = (ViewPager) view.findViewById(R.id.viewpager);
|
||||
MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager());
|
||||
String basicTitle = getResources().getString(R.string.basic_tab_title);
|
||||
String extendedTitle = getResources().getString(R.string.extended_tab_title);
|
||||
MyAdapter pagerAdapter = new MyAdapter(getChildFragmentManager(), basicTitle, extendedTitle);
|
||||
viewPager.setAdapter(pagerAdapter);
|
||||
|
||||
final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
|
||||
|
@ -441,8 +443,12 @@ public class EditPoiFragment extends Fragment {
|
|||
}
|
||||
|
||||
public static class MyAdapter extends FragmentPagerAdapter {
|
||||
public MyAdapter(FragmentManager fm) {
|
||||
private final String basicTitle;
|
||||
private final String extendedTitle;
|
||||
public MyAdapter(FragmentManager fm, String basicTitle, String extendedTitle) {
|
||||
super(fm);
|
||||
this.basicTitle = basicTitle;
|
||||
this.extendedTitle = extendedTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -466,9 +472,9 @@ public class EditPoiFragment extends Fragment {
|
|||
// TODO replace with string resources
|
||||
switch (position) {
|
||||
case 0:
|
||||
return "Normal";
|
||||
return basicTitle;
|
||||
case 1:
|
||||
return "Advanced";
|
||||
return extendedTitle;
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected position");
|
||||
}
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
package net.osmand.plus.osmedit.dialogs;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class OpeningHoursDaysDialogFragment extends DialogFragment {
|
||||
private static final Log LOG = PlatformUtil.getLog(OpeningHoursDaysDialogFragment.class);
|
||||
public static final String POSITION_TO_ADD = "position_to_add";
|
||||
public static final String ITEM = "item";
|
||||
|
||||
|
@ -24,7 +28,8 @@ public class OpeningHoursDaysDialogFragment extends DialogFragment {
|
|||
(OpeningHoursParser.BasicOpeningHourRule) getArguments().getSerializable(ITEM);
|
||||
final int positionToAdd = getArguments().getInt(POSITION_TO_ADD);
|
||||
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(),
|
||||
R.style.OsmandLightDialogTheme);
|
||||
|
||||
boolean add = positionToAdd > -1;
|
||||
Calendar inst = Calendar.getInstance();
|
||||
|
@ -34,11 +39,15 @@ public class OpeningHoursDaysDialogFragment extends DialogFragment {
|
|||
for (int i = 0; i < 7; i++) {
|
||||
int d = (first + i - 1) % 7 + 1;
|
||||
inst.set(Calendar.DAY_OF_WEEK, d);
|
||||
daysToShow[i] = DateFormat.format("EEEE", inst).toString(); //$NON-NLS-1$
|
||||
CharSequence dayName = DateFormat.format("EEEE", inst);
|
||||
String result = "" + Character.toUpperCase(dayName.charAt(0)) +
|
||||
dayName.subSequence(1, dayName.length());
|
||||
daysToShow[i] = result; //$NON-NLS-1$
|
||||
final int pos = (d + 5) % 7;
|
||||
dayToShow[i] = item.getDays()[pos];
|
||||
}
|
||||
b.setMultiChoiceItems(daysToShow, dayToShow, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
builder.setTitle("Working days");
|
||||
builder.setMultiChoiceItems(daysToShow, dayToShow, new DialogInterface.OnMultiChoiceClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
||||
|
@ -47,8 +56,7 @@ public class OpeningHoursDaysDialogFragment extends DialogFragment {
|
|||
}
|
||||
|
||||
});
|
||||
b.setPositiveButton(add ? getActivity().getString(R.string.shared_string_add)
|
||||
: getActivity().getString(R.string.shared_string_apply),
|
||||
builder.setPositiveButton(getActivity().getString(R.string.next_proceed),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -71,13 +79,12 @@ public class OpeningHoursDaysDialogFragment extends DialogFragment {
|
|||
|
||||
});
|
||||
|
||||
b.setNegativeButton(getActivity().getString(R.string.shared_string_cancel), null);
|
||||
|
||||
return b.create();
|
||||
builder.setNegativeButton(getActivity().getString(R.string.shared_string_cancel), null);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static OpeningHoursDaysDialogFragment createInstance(final OpeningHoursParser.BasicOpeningHourRule item,
|
||||
final int positionToAdd) {
|
||||
final int positionToAdd) {
|
||||
OpeningHoursDaysDialogFragment daysDialogFragment = new OpeningHoursDaysDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable(ITEM, item);
|
||||
|
|
|
@ -2,12 +2,19 @@ package net.osmand.plus.osmedit.dialogs;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.osmedit.NormalDataFragment;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
|
||||
|
@ -45,12 +52,27 @@ public class OpeningHoursHoursDialogFragment extends DialogFragment {
|
|||
initialState.set(Calendar.HOUR_OF_DAY, isStart? 8 : 20);
|
||||
initialState.set(Calendar.MINUTE, 0);
|
||||
}
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(), callback,
|
||||
TimePickerDialog timePickerDialog = new TimePickerDialog(getActivity(),
|
||||
R.style.OsmandLightDialogTheme,
|
||||
callback,
|
||||
initialState.get(Calendar.HOUR_OF_DAY),
|
||||
initialState.get(Calendar.MINUTE),
|
||||
DateFormat.is24HourFormat(getActivity()));
|
||||
|
||||
timePickerDialog.setTitle(isStart ? "Opening" : "Closing");
|
||||
int paddingInDp = 18;
|
||||
float density = getActivity().getResources().getDisplayMetrics().density;
|
||||
int paddingInPx = (int) (paddingInDp * density);
|
||||
|
||||
TextView titleTextView = new TextView(getActivity());
|
||||
titleTextView.setText(isStart ? getActivity().getString(R.string.opening_at)
|
||||
: getActivity().getString(R.string.closing_at));
|
||||
titleTextView.setPadding(paddingInPx, paddingInPx, paddingInPx, paddingInPx);
|
||||
titleTextView.setGravity(Gravity.CENTER_VERTICAL);
|
||||
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||
titleTextView.setTextColor(getActivity().getResources().getColor(R.color.color_black));
|
||||
Typeface typeface = titleTextView.getTypeface();
|
||||
titleTextView.setTypeface(typeface, Typeface.BOLD);
|
||||
timePickerDialog.setCustomTitle(titleTextView);
|
||||
return timePickerDialog;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue