Merge pull request #6986 from osmandapp/TrackerImprovements
Tracker improvements
This commit is contained in:
commit
b14152ce74
5 changed files with 38 additions and 36 deletions
|
@ -5,14 +5,14 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:paddingLeft="@dimen/content_padding_standard"
|
|
||||||
android:paddingRight="@dimen/content_padding_standard"
|
|
||||||
tools:background="@color/card_bg_light">
|
tools:background="@color/card_bg_light">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_standard"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||||
android:layout_marginTop="@dimen/image_button_padding"
|
android:layout_marginTop="@dimen/image_button_padding"
|
||||||
android:layout_marginEnd="@dimen/content_padding_big"
|
android:layout_marginEnd="@dimen/content_padding_big"
|
||||||
android:layout_marginRight="@dimen/content_padding_big"
|
android:layout_marginRight="@dimen/content_padding_big"
|
||||||
|
@ -53,10 +53,8 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_right"
|
android:id="@+id/icon_right"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingLeft="@dimen/image_button_padding"
|
|
||||||
android:paddingRight="@dimen/image_button_padding"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:src="@drawable/ic_action_additional_option"
|
tools:src="@drawable/ic_action_additional_option"
|
||||||
tools:tint="@color/icon_light"
|
tools:tint="@color/icon_light"
|
||||||
|
@ -65,10 +63,14 @@
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+id/switcher"
|
android:id="@+id/switcher"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false" />
|
android:focusable="false"
|
||||||
|
android:paddingStart="@dimen/image_button_padding"
|
||||||
|
android:paddingLeft="@dimen/image_button_padding"
|
||||||
|
android:paddingEnd="@dimen/content_padding_standard"
|
||||||
|
android:paddingRight="@dimen/content_padding_standard" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -53,12 +53,10 @@ class TelegramApplication : Application(), OsmandHelperListener {
|
||||||
listOf(-1)
|
listOf(-1)
|
||||||
)
|
)
|
||||||
showLocationHelper.addDirectionContextMenuButton()
|
showLocationHelper.addDirectionContextMenuButton()
|
||||||
if (settings.hasAnyChatToShowOnMap()) {
|
|
||||||
showLocationHelper.startShowingLocation()
|
showLocationHelper.startShowingLocation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
osmandAidlHelper.setUpdatesListener(object : UpdatesListener {
|
osmandAidlHelper.setUpdatesListener(object : UpdatesListener {
|
||||||
override fun update() {
|
override fun update() {
|
||||||
showLocationHelper.startUpdateMessagesTask()
|
showLocationHelper.startUpdateMessagesTask()
|
||||||
|
|
|
@ -912,8 +912,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class MinLocationDistance : NumericPref(
|
inner class MinLocationDistance : NumericPref(
|
||||||
R.drawable.ic_action_location_history,
|
0, R.string.min_logging_distance,
|
||||||
R.string.min_logging_distance,
|
|
||||||
R.string.min_logging_distance_descr,
|
R.string.min_logging_distance_descr,
|
||||||
MIN_LOCATION_DISTANCE
|
MIN_LOCATION_DISTANCE
|
||||||
) {
|
) {
|
||||||
|
@ -934,8 +933,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class MinLocationAccuracy : NumericPref(
|
inner class MinLocationAccuracy : NumericPref(
|
||||||
R.drawable.ic_action_location_history,
|
0, R.string.min_logging_accuracy,
|
||||||
R.string.min_logging_accuracy,
|
|
||||||
R.string.min_logging_accuracy_descr,
|
R.string.min_logging_accuracy_descr,
|
||||||
MIN_LOCATION_ACCURACY
|
MIN_LOCATION_ACCURACY
|
||||||
) {
|
) {
|
||||||
|
@ -956,8 +954,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class MinLocationSpeed : NumericPref(
|
inner class MinLocationSpeed : NumericPref(
|
||||||
R.drawable.ic_action_location_history,
|
0, R.string.min_logging_speed,
|
||||||
R.string.min_logging_speed,
|
|
||||||
R.string.min_logging_speed_descr,
|
R.string.min_logging_speed_descr,
|
||||||
MIN_LOCATION_SPEED
|
MIN_LOCATION_SPEED
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -88,22 +88,21 @@ class SettingsDialogFragment : BaseDialogFragment() {
|
||||||
findViewById<ImageView>(R.id.icon_right).apply {
|
findViewById<ImageView>(R.id.icon_right).apply {
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
setImageDrawable(uiUtils.getThemedIcon(R.drawable.ic_action_additional_option))
|
setImageDrawable(uiUtils.getThemedIcon(R.drawable.ic_action_additional_option))
|
||||||
setOnClickListener {
|
|
||||||
activity?.supportFragmentManager?.also { ProxySettingsDialogFragment.showInstance(it, this@SettingsDialogFragment) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
findViewById<TextView>(R.id.title).text = getText(R.string.proxy)
|
findViewById<TextView>(R.id.title).text = getText(R.string.proxy)
|
||||||
val description = findViewById<TextView>(R.id.description).apply {
|
val description = findViewById<TextView>(R.id.description).apply {
|
||||||
text = if (settings.proxyEnabled) getText(R.string.proxy_connected) else getText(R.string.proxy_disconnected)
|
text = if (settings.proxyEnabled) getText(R.string.proxy_connected) else getText(R.string.proxy_disconnected)
|
||||||
}
|
}
|
||||||
val switcher = findViewById<Switch>(R.id.switcher).apply {
|
findViewById<Switch>(R.id.switcher).apply {
|
||||||
|
isClickable = true
|
||||||
isChecked = app.settings.proxyEnabled
|
isChecked = app.settings.proxyEnabled
|
||||||
|
setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
settings.updateProxySetting(isChecked)
|
||||||
|
description.text = if (isChecked) getText(R.string.proxy_connected) else getText(R.string.proxy_disconnected)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
val checked = !app.settings.proxyEnabled
|
activity?.supportFragmentManager?.also { ProxySettingsDialogFragment.showInstance(it, this@SettingsDialogFragment) }
|
||||||
switcher.isChecked = checked
|
|
||||||
settings.updateProxySetting(checked)
|
|
||||||
description.text = if (checked) getText(R.string.proxy_connected) else getText(R.string.proxy_disconnected)
|
|
||||||
}
|
}
|
||||||
container.addView(this)
|
container.addView(this)
|
||||||
}
|
}
|
||||||
|
@ -246,7 +245,13 @@ class SettingsDialogFragment : BaseDialogFragment() {
|
||||||
|
|
||||||
private fun createNumericPref(inflater: LayoutInflater, container: ViewGroup, pref: NumericPref) {
|
private fun createNumericPref(inflater: LayoutInflater, container: ViewGroup, pref: NumericPref) {
|
||||||
inflater.inflate(R.layout.item_with_desc_and_right_value, container, false).apply {
|
inflater.inflate(R.layout.item_with_desc_and_right_value, container, false).apply {
|
||||||
findViewById<ImageView>(R.id.icon).setImageDrawable(uiUtils.getThemedIcon(pref.iconId))
|
findViewById<ImageView>(R.id.icon).apply {
|
||||||
|
if (pref.iconId != 0) {
|
||||||
|
setImageDrawable(uiUtils.getThemedIcon(pref.iconId))
|
||||||
|
} else {
|
||||||
|
visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
findViewById<TextView>(R.id.title).setText(pref.titleId)
|
findViewById<TextView>(R.id.title).setText(pref.titleId)
|
||||||
findViewById<TextView>(R.id.description).setText(pref.descriptionId)
|
findViewById<TextView>(R.id.description).setText(pref.descriptionId)
|
||||||
val valueView = findViewById<TextView>(R.id.value)
|
val valueView = findViewById<TextView>(R.id.value)
|
||||||
|
|
|
@ -136,9 +136,9 @@ public class AMapPointMenuController extends MenuController {
|
||||||
public CharSequence getAdditionalInfoStr() {
|
public CharSequence getAdditionalInfoStr() {
|
||||||
MapActivity activity = getMapActivity();
|
MapActivity activity = getMapActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
float bearing = getPointBearing();
|
float speed = getPointSpeed();
|
||||||
if (bearing != NO_VALUE) {
|
if (speed != NO_VALUE) {
|
||||||
return OsmAndFormatter.getFormattedAzimuth(bearing, activity.getMyApplication());
|
return OsmAndFormatter.getFormattedSpeed(speed, activity.getMyApplication());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getAdditionalInfoStr();
|
return super.getAdditionalInfoStr();
|
||||||
|
@ -149,9 +149,9 @@ public class AMapPointMenuController extends MenuController {
|
||||||
public String getSubtypeStr() {
|
public String getSubtypeStr() {
|
||||||
MapActivity activity = getMapActivity();
|
MapActivity activity = getMapActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
float speed = getPointSpeed();
|
float bearing = getPointBearing();
|
||||||
if (speed != NO_VALUE) {
|
if (bearing != NO_VALUE) {
|
||||||
return OsmAndFormatter.getFormattedSpeed(speed, activity.getMyApplication());
|
return OsmAndFormatter.getFormattedAzimuth(bearing, activity.getMyApplication());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getSubtypeStr();
|
return super.getSubtypeStr();
|
||||||
|
@ -160,16 +160,16 @@ public class AMapPointMenuController extends MenuController {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Drawable getSubtypeIcon() {
|
public Drawable getSubtypeIcon() {
|
||||||
if (getPointSpeed() != NO_VALUE) {
|
if (getPointBearing() != NO_VALUE) {
|
||||||
return getIcon(R.drawable.ic_action_speed_16);
|
return getIcon(R.drawable.ic_action_bearing_16);
|
||||||
}
|
}
|
||||||
return super.getSubtypeIcon();
|
return super.getSubtypeIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAdditionalInfoIconRes() {
|
public int getAdditionalInfoIconRes() {
|
||||||
if (getPointBearing() != NO_VALUE) {
|
if (getPointSpeed() != NO_VALUE) {
|
||||||
return R.drawable.ic_action_bearing;
|
return R.drawable.ic_action_speed_16;
|
||||||
}
|
}
|
||||||
return super.getAdditionalInfoIconRes();
|
return super.getAdditionalInfoIconRes();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue