Fix night theme
This commit is contained in:
parent
c52c7eb1a9
commit
3ba25cb95f
11 changed files with 41 additions and 9 deletions
8
OsmAnd/res/drawable/marker_circle_background_dark_n.xml
Normal file
8
OsmAnd/res/drawable/marker_circle_background_dark_n.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid
|
||||
android:color="@color/marker_circle_button_color_dark"/>
|
||||
</shape>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/marker_circle_background_dark_n"
|
||||
android:insetBottom="14dp"
|
||||
android:insetLeft="14dp"
|
||||
android:insetRight="14dp"
|
||||
android:insetTop="14dp"/>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/marker_circle_background_p_with_inset" android:state_pressed="true"/>
|
||||
<item android:drawable="@drawable/marker_circle_background_dark_n_with_inset"/>
|
||||
|
||||
</selector>
|
|
@ -97,7 +97,7 @@
|
|||
android:layout_gravity="center_vertical|end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
android:textColor="@color/map_widget_blue_pressed"
|
||||
tools:textColor="@color/map_widget_blue_pressed"
|
||||
tools:text="Top bar"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
android:id="@+id/map_marker_options_button"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:background="@drawable/marker_circle_background_light_with_inset"
|
||||
tools:background="@drawable/marker_circle_background_dark_with_inset"
|
||||
android:focusableInTouchMode="true"
|
||||
tools:src="@drawable/ic_action_marker_passed"/>
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
|||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="56dp"
|
||||
android:layout_marginStart="56dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
tools:background="?attr/dashboard_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -262,4 +262,6 @@
|
|||
<color name="map_markers_on_map_color">#17828a</color>
|
||||
<color name="show_direction_menu_selected_item_bg">#f2f4ff</color>
|
||||
|
||||
<color name="marker_circle_button_color_dark">#525e66</color>
|
||||
|
||||
</resources>
|
|
@ -5,6 +5,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -18,6 +19,7 @@ import android.widget.TextView;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BottomSheetDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
||||
|
@ -35,8 +37,9 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||
boolean nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
boolean nightMode = !getMyApplication().getSettings().isLightContent();
|
||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_options_bottom_sheet_dialog, container);
|
||||
|
@ -68,6 +71,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
((ImageView) mainView.findViewById(R.id.move_all_to_history_icon))
|
||||
.setImageDrawable(getContentIcon(R.drawable.ic_action_history2));
|
||||
|
||||
((TextView) mainView.findViewById(R.id.show_direction_text_view)).setTextColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.color_dialog_buttons_dark : R.color.map_widget_blue_pressed));
|
||||
((TextView) mainView.findViewById(R.id.show_direction_text_view)).setText(getMyApplication().getSettings().MAP_MARKERS_MODE.get().toHumanString(getActivity()));
|
||||
|
||||
mainView.findViewById(R.id.sort_by_row).setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -207,7 +207,7 @@ public class ShowDirectionBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
private void highlightSelectedItem(OsmandSettings.MapMarkersMode mode, boolean check) {
|
||||
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 ? R.color.dashboard_blue : night ? R.color.color_white : R.color.color_black);
|
||||
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);
|
||||
switch (mode) {
|
||||
case TOOLBAR:
|
||||
((RadioButton) mainView.findViewById(R.id.top_bar_radio_button)).setChecked(check);
|
||||
|
|
|
@ -114,8 +114,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
|
|||
holder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, markerColor));
|
||||
holder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
|
||||
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light));
|
||||
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_light_with_inset));
|
||||
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
|
||||
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
|
||||
holder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_marker_passed));
|
||||
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
|
||||
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
|
||||
|
|
|
@ -195,8 +195,8 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
itemViewHolder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, color));
|
||||
itemViewHolder.mainLayout.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||
itemViewHolder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.color_white : R.color.color_black));
|
||||
itemViewHolder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light));
|
||||
itemViewHolder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(R.drawable.marker_circle_background_light_with_inset));
|
||||
itemViewHolder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
|
||||
itemViewHolder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
|
||||
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(markerInHistory ? R.drawable.ic_action_reset_to_default_dark : R.drawable.ic_action_marker_passed));
|
||||
itemViewHolder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.dash_search_icon_dark : R.color.icon_color));
|
||||
|
||||
|
|
|
@ -35,9 +35,11 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
private List<Object> items = new ArrayList<>();
|
||||
private MapMarkersHistoryAdapterListener listener;
|
||||
private Snackbar snackbar;
|
||||
private boolean night;
|
||||
|
||||
public MapMarkersHistoryAdapter(OsmandApplication app) {
|
||||
this.app = app;
|
||||
night = !app.getSettings().isLightContent();
|
||||
createHeaders();
|
||||
}
|
||||
|
||||
|
@ -125,6 +127,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
|
||||
itemViewHolder.description.setText(app.getString(R.string.passed, new SimpleDateFormat("MMM dd", Locale.getDefault()).format(new Date(marker.visitedDate))));
|
||||
|
||||
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));
|
||||
itemViewHolder.optionsBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -158,6 +161,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
|
|||
if ((getItemCount() > position + 1 && getItemViewType(position + 1) == HEADER_TYPE) || lastItem) {
|
||||
itemViewHolder.divider.setVisibility(View.GONE);
|
||||
} else {
|
||||
itemViewHolder.divider.setBackgroundColor(ContextCompat.getColor(app, night ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
|
||||
itemViewHolder.divider.setVisibility(View.VISIBLE);
|
||||
}
|
||||
itemViewHolder.bottomShadow.setVisibility(lastItem ? View.VISIBLE : View.GONE);
|
||||
|
|
Loading…
Reference in a new issue