commit
68a0cd5350
6 changed files with 36 additions and 10 deletions
|
@ -10,6 +10,9 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:textColorPrimary"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_small"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_small"
|
||||||
android:text="@string/keep_showing_on_map"/>
|
android:text="@string/keep_showing_on_map"/>
|
||||||
|
|
||||||
<android.support.v7.widget.SwitchCompat
|
<android.support.v7.widget.SwitchCompat
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="@dimen/list_item_height"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
android:paddingLeft="20dp"
|
android:paddingLeft="20dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
tools:text="Some waypoint text"/>
|
tools:text="Some waypoint text"/>
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
TypedValue typedValue = new TypedValue();
|
TypedValue typedValue = new TypedValue();
|
||||||
FragmentActivity activity = requireActivity();
|
FragmentActivity activity = requireActivity();
|
||||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
boolean nightMode = isNightMode();
|
||||||
context = new ContextThemeWrapper(activity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
context = new ContextThemeWrapper(activity, !nightMode ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
|
||||||
Theme theme = context.getTheme();
|
Theme theme = context.getTheme();
|
||||||
theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
|
theme.resolveAttribute(android.R.attr.textColorPrimary, typedValue, true);
|
||||||
|
@ -132,14 +133,13 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
subtextView.setText(description);
|
subtextView.setText(description);
|
||||||
final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.toggle_item);
|
final CompoundButton compoundButton = (CompoundButton) view.findViewById(R.id.toggle_item);
|
||||||
compoundButton.setChecked(pref.get());
|
compoundButton.setChecked(pref.get());
|
||||||
textView.setTextColor(pref.get() ? textColorPrimary : textColorSecondary);
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
compoundButton.setOnCheckedChangeListener(
|
@Override
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
public void onClick(View v) {
|
||||||
@Override
|
compoundButton.setChecked(!compoundButton.isChecked());
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
}
|
||||||
textView.setTextColor(b ? textColorPrimary : textColorSecondary);
|
});
|
||||||
}
|
UiUtilities.setupCompoundButton(compoundButton, isNightMode(), UiUtilities.CompoundButtonType.GLOBAL);
|
||||||
});
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +244,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DashViewHolder {
|
private class DashViewHolder {
|
||||||
|
final View view;
|
||||||
final TextView textView;
|
final TextView textView;
|
||||||
final CompoundButton compoundButton;
|
final CompoundButton compoundButton;
|
||||||
final TextView numberOfRowsTextView;
|
final TextView numberOfRowsTextView;
|
||||||
|
@ -252,6 +253,7 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
private DashFragmentAdapter dashFragmentAdapter;
|
private DashFragmentAdapter dashFragmentAdapter;
|
||||||
|
|
||||||
public DashViewHolder(DashFragmentAdapter dashFragmentAdapter, View view, Context ctx) {
|
public DashViewHolder(DashFragmentAdapter dashFragmentAdapter, View view, Context ctx) {
|
||||||
|
this.view = view;
|
||||||
this.dashFragmentAdapter = dashFragmentAdapter;
|
this.dashFragmentAdapter = dashFragmentAdapter;
|
||||||
this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView);
|
this.numberOfRowsTextView = (TextView) view.findViewById(R.id.numberOfRowsTextView);
|
||||||
this.textView = (TextView) view.findViewById(R.id.text);
|
this.textView = (TextView) view.findViewById(R.id.text);
|
||||||
|
@ -277,9 +279,16 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
textColorSecondary);
|
textColorSecondary);
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
compoundButton.setChecked(!compoundButton.isChecked());
|
||||||
|
}
|
||||||
|
});
|
||||||
compoundButton.setChecked(dashFragmentAdapter.isChecked(position));
|
compoundButton.setChecked(dashFragmentAdapter.isChecked(position));
|
||||||
compoundButton.setTag(this);
|
compoundButton.setTag(this);
|
||||||
compoundButton.setOnCheckedChangeListener(dashFragmentAdapter.onTurnedOnOffListener);
|
compoundButton.setOnCheckedChangeListener(dashFragmentAdapter.onTurnedOnOffListener);
|
||||||
|
UiUtilities.setupCompoundButton(compoundButton, isNightMode(), UiUtilities.CompoundButtonType.GLOBAL);
|
||||||
|
|
||||||
numberOfRowsTextView.setTag(this);
|
numberOfRowsTextView.setTag(this);
|
||||||
numberOfRowsTextView.setOnClickListener(dashFragmentAdapter.onNumberClickListener);
|
numberOfRowsTextView.setOnClickListener(dashFragmentAdapter.onNumberClickListener);
|
||||||
|
@ -287,4 +296,8 @@ public class DashboardSettingsDialogFragment extends DialogFragment
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNightMode() {
|
||||||
|
return mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1512,6 +1512,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
final View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.close_measurement_tool_dialog, null);
|
final View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.close_measurement_tool_dialog, null);
|
||||||
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
||||||
|
|
||||||
|
view.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
showOnMapToggle.setChecked(!showOnMapToggle.isChecked());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1531,6 +1538,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
UiUtilities.setupCompoundButton(showOnMapToggle, nightMode, UiUtilities.CompoundButtonType.GLOBAL);
|
||||||
} else {
|
} else {
|
||||||
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue