Create DirectionIndicationDialogFragment
This commit is contained in:
parent
007b4ebcb2
commit
ed1e04f6af
7 changed files with 512 additions and 4 deletions
366
OsmAnd/res/layout/fragment_direction_indication_dialog.xml
Normal file
366
OsmAnd/res/layout/fragment_direction_indication_dialog.xml
Normal file
|
@ -0,0 +1,366 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
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"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/actionModeBackground"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
app:contentInsetLeft="54dp"
|
||||
app:contentInsetStart="54dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_settings"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/action_bar_image_height"
|
||||
android:background="?attr/actionModeBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/action_bar_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="@dimen/action_bar_image_side_margin"
|
||||
android:layout_marginRight="@dimen/action_bar_image_side_margin"
|
||||
tools:src="@drawable/img_help_markers_direction_device_night"/>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/active_markers"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/active_markers_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?attr/contextMenuButtonColor"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:drawableRight="@drawable/ic_action_arrow_drop_down"
|
||||
tools:text="Two"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding"
|
||||
android:text="@string/active_markers_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/distance_indication_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/show_direction"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/distance_indication_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding"
|
||||
android:text="@string/distance_indication_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_bar_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top_bar_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_topbar"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_topbar"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/top_bar_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:background="@drawable/ic_action_device_top"
|
||||
tools:src="@drawable/ic_action_device_widget"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_widgets"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/widget_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/show_arrows_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/show_arrows_on_the_map"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_arrows_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding"
|
||||
android:text="@string/show_arrows_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/show_guide_line_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/show_guide_line"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/show_guide_line_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:paddingBottom="@dimen/content_padding"
|
||||
android:paddingTop="@dimen/content_padding"
|
||||
android:text="@string/show_guide_line_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/list_item_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -126,6 +126,9 @@
|
|||
<dimen name="bottom_sheet_image_text_margin_start">15dp</dimen>
|
||||
<dimen name="bottom_sheet_selected_item_title_height">84dp</dimen>
|
||||
|
||||
<dimen name="action_bar_image_height">330dp</dimen>
|
||||
<dimen name="action_bar_image_side_margin">105dp</dimen>
|
||||
|
||||
<dimen name="map_markers_recycler_view_padding_bottom">78dp</dimen>
|
||||
<dimen name="map_markers_recycler_view_padding_top">15dp</dimen>
|
||||
|
||||
|
|
|
@ -189,6 +189,9 @@
|
|||
<dimen name="bottom_sheet_image_text_margin_start">10dp</dimen>
|
||||
<dimen name="bottom_sheet_selected_item_title_height">56dp</dimen>
|
||||
|
||||
<dimen name="action_bar_image_height">220dp</dimen>
|
||||
<dimen name="action_bar_image_side_margin">70dp</dimen>
|
||||
|
||||
<dimen name="map_markers_recycler_view_padding_bottom">52dp</dimen>
|
||||
<dimen name="map_markers_recycler_view_padding_top">10dp</dimen>
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="show_guide_line_descr">A line connecting your location to locations of the active markers will be shown on the map.</string>
|
||||
<string name="show_arrows_descr">One or two arrows indicating the direction to the active markers will be shown on the map.</string>
|
||||
<string name="distance_indication_descr">Choose how you\'d like to view the distance to the active markers.</string>
|
||||
<string name="active_markers_descr">Choose how many direction indicators you\'d like to see.</string>
|
||||
<string name="digits_quantity">Digits quantity</string>
|
||||
<string name="shared_string_right">Right</string>
|
||||
<string name="shared_string_left">Left</string>
|
||||
|
|
|
@ -1315,6 +1315,8 @@ public class OsmandSettings {
|
|||
|
||||
public final OsmandPreference<Boolean> USE_MAP_MARKERS = new BooleanPreference("use_map_markers", true).makeGlobal().cache();
|
||||
|
||||
public final OsmandPreference<Boolean> MARKERS_DISTANCE_INDICATION_ENABLED = new BooleanPreference("markers_distance_indication_enabled", true).makeGlobal();
|
||||
|
||||
public final CommonPreference<MapMarkersMode> MAP_MARKERS_MODE =
|
||||
new EnumIntPreference<>("map_markers_mode", MapMarkersMode.TOOLBAR, MapMarkersMode.values());
|
||||
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.widget.CompoundButtonCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RadioButton;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.MapMarkersMode;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
|
||||
public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment {
|
||||
|
||||
public final static String TAG = "DirectionIndicationDialogFragment";
|
||||
|
||||
private View mainView;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandSettings settings = getSettings();
|
||||
|
||||
mainView = inflater.inflate(R.layout.fragment_direction_indication_dialog, container);
|
||||
|
||||
Toolbar toolbar = mainView.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton distanceIndicationToggle = (CompoundButton) mainView.findViewById(R.id.distance_indication_switch);
|
||||
distanceIndicationToggle.setChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED.get());
|
||||
mainView.findViewById(R.id.distance_indication_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.MARKERS_DISTANCE_INDICATION_ENABLED, distanceIndicationToggle);
|
||||
updateSelection();
|
||||
}
|
||||
});
|
||||
|
||||
updateSelection();
|
||||
|
||||
final CompoundButton showArrowsToggle = (CompoundButton) mainView.findViewById(R.id.show_arrows_switch);
|
||||
showArrowsToggle.setChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_arrows_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.SHOW_ARROWS_TO_FIRST_MARKERS, showArrowsToggle);
|
||||
}
|
||||
});
|
||||
|
||||
final CompoundButton showLinesToggle = (CompoundButton) mainView.findViewById(R.id.show_guide_line_switch);
|
||||
showLinesToggle.setChecked(settings.SHOW_LINES_TO_FIRST_MARKERS.get());
|
||||
mainView.findViewById(R.id.show_guide_line_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
updateChecked(settings.SHOW_LINES_TO_FIRST_MARKERS, showLinesToggle);
|
||||
}
|
||||
});
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Drawable getContentIcon(int id) {
|
||||
return getIcon(id, getSettings().isLightContent() ? R.color.icon_color : R.color.ctx_menu_info_text_dark);
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null && activity instanceof MapActivity) {
|
||||
return (MapActivity) activity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateChecked(OsmandPreference<Boolean> setting, CompoundButton button) {
|
||||
boolean newState = !setting.get();
|
||||
setting.set(newState);
|
||||
button.setChecked(newState);
|
||||
if (getMapActivity() != null) {
|
||||
getMapActivity().refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSelection() {
|
||||
OsmandSettings settings = getSettings();
|
||||
MapMarkersMode mode = settings.MAP_MARKERS_MODE.get();
|
||||
boolean distanceIndicationEnabled = settings.MARKERS_DISTANCE_INDICATION_ENABLED.get();
|
||||
boolean topBar = mode == MapMarkersMode.TOOLBAR;
|
||||
boolean widget = mode == MapMarkersMode.WIDGETS;
|
||||
updateIcon(R.id.top_bar_icon, R.drawable.ic_action_device_topbar, topBar && distanceIndicationEnabled);
|
||||
updateIcon(R.id.widget_icon, R.drawable.ic_action_device_widget, widget && distanceIndicationEnabled);
|
||||
updateRadioButton(R.id.top_bar_radio_button, topBar, distanceIndicationEnabled);
|
||||
updateRadioButton(R.id.widget_radio_button, widget, distanceIndicationEnabled);
|
||||
}
|
||||
|
||||
private void updateIcon(int imageViewId, int drawableId, boolean active) {
|
||||
ImageView iv = (ImageView) mainView.findViewById(imageViewId);
|
||||
iv.setBackgroundDrawable(active
|
||||
? getIcon(R.drawable.ic_action_device_top, R.color.dashboard_blue)
|
||||
: getContentIcon(R.drawable.ic_action_device_top));
|
||||
iv.setImageDrawable(active
|
||||
? getIcon(drawableId, R.color.osmand_orange)
|
||||
: getContentIcon(drawableId));
|
||||
}
|
||||
|
||||
private void updateRadioButton(int radioButtonId, boolean checked, boolean active) {
|
||||
boolean night = !getSettings().isLightContent();
|
||||
RadioButton rb = (RadioButton) mainView.findViewById(radioButtonId);
|
||||
rb.setChecked(checked);
|
||||
int colorId = active ? night ? R.color.osmand_orange : R.color.dashboard_blue
|
||||
: night ? R.color.ctx_menu_info_text_dark : R.color.icon_color;
|
||||
CompoundButtonCompat.setButtonTintList(rb, ColorStateList.valueOf(ContextCompat.getColor(getContext(), colorId)));
|
||||
}
|
||||
}
|
|
@ -245,10 +245,8 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
@Override
|
||||
public void showDirectionOnClick() {
|
||||
if (mapActivity != null) {
|
||||
ShowDirectionBottomSheetDialogFragment fragment = new ShowDirectionBottomSheetDialogFragment();
|
||||
fragment.setUsedOnMap(false);
|
||||
fragment.setListener(createShowDirectionFragmentListener());
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), ShowDirectionBottomSheetDialogFragment.TAG);
|
||||
DirectionIndicationDialogFragment fragment = new DirectionIndicationDialogFragment();
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), DirectionIndicationDialogFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue