UI styling

This commit is contained in:
PavelRatushny 2017-10-11 16:17:11 +03:00
parent dd767f76ca
commit f8697fbb8d
7 changed files with 42 additions and 20 deletions

View file

@ -45,15 +45,15 @@
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/map_marker_title"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:textStyle="bold"
android:textSize="@dimen/default_list_text_size"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?android:textColorPrimary"
tools:text="Bloemstraat 179"/>
<net.osmand.plus.widgets.TextViewEx
@ -61,11 +61,10 @@
android:id="@+id/map_marker_passed_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:ellipsize="end"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"
tools:text="Passed: July 28"/>
</LinearLayout>

View file

@ -208,14 +208,16 @@
tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_topbar"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/top_bar_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_topbar"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/top_bar_radio_button"
@ -255,14 +257,16 @@
tools:background="@drawable/ic_action_device_top"
tools:src="@drawable/ic_action_device_widget"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/widget_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_widgets"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/widget_radio_button"
@ -301,14 +305,16 @@
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:background="@drawable/ic_action_device_top"/>
<TextView
<net.osmand.plus.widgets.TextViewEx
osmand:typeface="@string/font_roboto_regular"
android:id="@+id/none_text"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/shared_string_none"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
<RadioButton
android:id="@+id/none_radio_button"

View file

@ -41,7 +41,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
final RecyclerView recyclerView = new RecyclerView(getContext());
final MapActivity mapActivity = (MapActivity) getActivity();
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -57,7 +57,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -76,7 +76,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 8 : 12));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

View file

@ -1,6 +1,7 @@
package net.osmand.plus.mapmarkers;
import android.app.Activity;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
@ -26,6 +27,7 @@ import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache;
public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFragment {
@ -208,6 +210,7 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
int iconBgColor = check ? R.color.dashboard_blue : R.color.on_map_icon_color;
int iconColor = check ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue;
int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black);
Typeface typeface = FontCache.getFont(getContext(), check ? "fonts/Roboto-Medium.ttf" : "fonts/Roboto-Regular.ttf");
switch (mode) {
case TOOLBAR:
((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check);
@ -217,7 +220,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
mainView.findViewById(R.id.top_bar_row_frame).setBackgroundResource(0);
}
((TextView) mainView.findViewById(R.id.top_bar_text)).setTextColor(textColor);
TextView topBarText = (TextView) mainView.findViewById(R.id.top_bar_text);
topBarText.setTextColor(textColor);
topBarText.setTypeface(typeface);
topBarIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
topBarIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_topbar, iconColor));
break;
@ -229,7 +234,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
mainView.findViewById(R.id.widget_row_frame).setBackgroundResource(0);
}
((TextView) mainView.findViewById(R.id.widget_text)).setTextColor(textColor);
TextView widgetText = (TextView) mainView.findViewById(R.id.widget_text);
widgetText.setTextColor(textColor);
widgetText.setTypeface(typeface);
widgetIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
widgetIcon.setImageDrawable(getIcon(R.drawable.ic_action_device_widget, iconColor));
break;
@ -241,7 +248,9 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
} else {
mainView.findViewById(R.id.none_row_frame).setBackgroundResource(0);
}
((TextView) mainView.findViewById(R.id.none_text)).setTextColor(textColor);
TextView noneText = (TextView) mainView.findViewById(R.id.none_text);
noneText.setTextColor(textColor);
noneText.setTypeface(typeface);
noneIcon.setBackgroundDrawable(getIcon(R.drawable.ic_action_device_top, iconBgColor));
break;
}

View file

@ -130,7 +130,15 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
month = Character.toUpperCase(month.charAt(0)) + month.substring(1);
}
String day = new SimpleDateFormat("dd", Locale.getDefault()).format(date);
itemViewHolder.description.setText(app.getString(R.string.passed, month + " " + day));
String desc = app.getString(R.string.passed, month + " " + day);
String markerGroupName = marker.groupName;
if (markerGroupName != null) {
if (markerGroupName.equals("")) {
markerGroupName = app.getString(R.string.shared_string_favorites);
}
desc += "" + markerGroupName;
}
itemViewHolder.description.setText(desc);
itemViewHolder.optionsBtn.setBackgroundDrawable(app.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reset_to_default_dark));