Merge branch 'master' of ssh://github.com/osmandapp/Osmand into CompassRulerImprovements
|
@ -35,13 +35,21 @@
|
|||
android:layout_marginStart="@dimen/list_item_icon_margin_left"
|
||||
tools:src="@drawable/img_user_picture"/>
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingTop="@dimen/content_padding_half"
|
||||
android:paddingBottom="@dimen/content_padding_half">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/title"
|
||||
|
@ -51,7 +59,6 @@
|
|||
android:maxLines="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/list_item_title_text_size"
|
||||
android:paddingTop="@dimen/content_padding_half"
|
||||
app:typeface="@string/font_roboto_regular"
|
||||
tools:text="Share location"/>
|
||||
|
||||
|
@ -117,7 +124,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:paddingBottom="@dimen/content_padding_half"
|
||||
tools:visibility="visible">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
|
@ -137,6 +143,8 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_box"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -64,25 +64,30 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis
|
|||
if (usedBy and usageIntent > 0) {
|
||||
usedBy -= usageIntent
|
||||
}
|
||||
if (usedBy == 0) {
|
||||
shouldCleanupResources = false
|
||||
val serviceIntent = Intent(ctx, TelegramService::class.java)
|
||||
ctx.stopService(serviceIntent)
|
||||
} else if (isUsedByMyLocation(usedBy)) {
|
||||
val app = app()
|
||||
if (app.settings.sendMyLocInterval >= OFF_INTERVAL_THRESHOLD && serviceOffInterval == 0L) {
|
||||
serviceOffInterval = app.settings.sendMyLocInterval
|
||||
setupServiceErrorInterval()
|
||||
setupAlarm()
|
||||
when {
|
||||
usedBy == 0 -> {
|
||||
shouldCleanupResources = false
|
||||
val serviceIntent = Intent(ctx, TelegramService::class.java)
|
||||
ctx.stopService(serviceIntent)
|
||||
}
|
||||
app.notificationHelper.refreshNotification(NotificationType.LOCATION)
|
||||
isUsedByMyLocation(usedBy) -> {
|
||||
val app = app()
|
||||
if (app.settings.sendMyLocInterval >= OFF_INTERVAL_THRESHOLD && serviceOffInterval == 0L) {
|
||||
serviceOffInterval = app.settings.sendMyLocInterval
|
||||
setupServiceErrorInterval()
|
||||
setupAlarm()
|
||||
}
|
||||
app.notificationHelper.refreshNotification(NotificationType.LOCATION)
|
||||
}
|
||||
isUsedByUsersLocations(usedBy) -> removeLocationUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
val app = app()
|
||||
handler = Handler()
|
||||
usedBy = intent.getIntExtra(USAGE_INTENT, 0)
|
||||
val usageIntent = intent.getIntExtra(USAGE_INTENT, 0)
|
||||
usedBy = usageIntent or usedBy
|
||||
|
||||
serviceOffInterval = intent.getLongExtra(USAGE_OFF_INTERVAL, 0)
|
||||
sendLocationInterval = intent.getLongExtra(SEND_LOCATION_INTERVAL, 0)
|
||||
|
@ -259,10 +264,8 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis
|
|||
Toast.makeText(this, getString(R.string.location_service_no_gps_available), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
|
||||
override fun onProviderEnabled(provider: String) {}
|
||||
|
||||
|
||||
override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {}
|
||||
|
||||
override fun onTaskRemoved(rootIntent: Intent) {
|
||||
|
|
|
@ -45,7 +45,7 @@ private const val TIMELINE_TAB_POS = 2
|
|||
|
||||
class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListener, TelegramIncomingMessagesListener {
|
||||
|
||||
private val log = PlatformUtil.getLog(TelegramHelper::class.java)
|
||||
private val log = PlatformUtil.getLog(MainActivity::class.java)
|
||||
|
||||
private var telegramAuthorizationRequestHandler: TelegramAuthorizationRequestHandler? = null
|
||||
private var paused: Boolean = false
|
||||
|
|
4
OsmAnd/res/color-v21/dlg_btn_secondary_text_dark.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_dark" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_dark" />
|
||||
</selector>
|
4
OsmAnd/res/color-v21/dlg_btn_secondary_text_light.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_light" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_light" />
|
||||
</selector>
|
5
OsmAnd/res/color/dlg_btn_primary_text_dark.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_dark" android:state_pressed="true" />
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_dark" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_text_dark" />
|
||||
</selector>
|
5
OsmAnd/res/color/dlg_btn_primary_text_light.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_light" android:state_pressed="true" />
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_light" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_text_light" />
|
||||
</selector>
|
5
OsmAnd/res/color/dlg_btn_secondary_text_dark.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_dark" android:state_pressed="true" />
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_dark" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_dark" />
|
||||
</selector>
|
5
OsmAnd/res/color/dlg_btn_secondary_text_light.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/active_buttons_and_links_text_light" android:state_pressed="true" />
|
||||
<item android:color="@color/active_buttons_and_links_text_disabled_light" android:state_enabled="false" />
|
||||
<item android:color="@color/active_buttons_and_links_light" />
|
||||
</selector>
|
BIN
OsmAnd/res/drawable-hdpi/img_feedback.webp
Normal file
After Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
BIN
OsmAnd/res/drawable-mdpi/img_feedback.webp
Normal file
After Width: | Height: | Size: 2 KiB |
13
OsmAnd/res/drawable-v21/dlg_btn_primary_dark.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
13
OsmAnd/res/drawable-v21/dlg_btn_primary_light.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
13
OsmAnd/res/drawable-v21/dlg_btn_secondary_dark.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
13
OsmAnd/res/drawable-v21/dlg_btn_secondary_light.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/profile_button_gray" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
24
OsmAnd/res/drawable-v21/dlg_btn_stroked_dark.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/inactive_pages_dark" />
|
||||
<solid android:color="@color/stroked_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
23
OsmAnd/res/drawable-v21/dlg_btn_stroked_light.xml
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="1dp" android:color="@color/profile_button_gray" />
|
||||
<solid android:color="@color/stroked_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
BIN
OsmAnd/res/drawable-xhdpi/img_feedback.webp
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/img_feedback.webp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
OsmAnd/res/drawable-xxxhdpi/img_feedback.webp
Normal file
After Width: | Height: | Size: 21 KiB |
|
@ -8,7 +8,7 @@
|
|||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/activity_background_dark" />
|
||||
<solid android:color="@color/card_and_list_background_dark" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_dark" />
|
||||
<stroke android:width="1dp" android:color="@color/inactive_pages_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -16,7 +16,7 @@
|
|||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_light" />
|
||||
<stroke android:width="1dp" android:color="@color/profile_button_gray" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
17
OsmAnd/res/drawable/dlg_btn_primary_dark.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
16
OsmAnd/res/drawable/dlg_btn_primary_light.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
17
OsmAnd/res/drawable/dlg_btn_secondary_dark.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
17
OsmAnd/res/drawable/dlg_btn_secondary_light.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<solid android:color="@color/profile_button_gray" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
18
OsmAnd/res/drawable/dlg_btn_stroked_dark.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<stroke android:color="@color/inactive_pages_dark" android:width="1dp" />
|
||||
<solid android:color="@color/stroked_buttons_and_links_dark" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
18
OsmAnd/res/drawable/dlg_btn_stroked_light.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_pressed_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item android:state_enabled="false"><shape android:shape="rectangle">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
<item><shape android:shape="rectangle">
|
||||
<stroke android:color="@color/profile_button_gray" android:width="1dp" />
|
||||
<solid android:color="@color/stroked_buttons_and_links_light" />
|
||||
<corners android:radius="@dimen/dlg_button_rect_rad" />
|
||||
</shape></item>
|
||||
|
||||
</selector>
|
|
@ -2,7 +2,7 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/inactive_buttons_and_links_dark"/>
|
||||
<solid android:color="@color/inactive_pages_dark"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/inactive_buttons_and_links_light"/>
|
||||
<solid android:color="@color/inactive_pages_light"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
9
OsmAnd/res/drawable/ripple_solid_dark.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/solid_ripple_color">
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_dark" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
9
OsmAnd/res/drawable/ripple_solid_light.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/solid_ripple_color">
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/active_buttons_and_links_light" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
29
OsmAnd/res/layout/bottom_sheet_dialog_button.xml
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/button_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="UselessParent">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/button_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/content_padding_small"
|
||||
android:paddingRight="@dimen/content_padding_small"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -71,6 +71,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="64dp"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -17,8 +15,7 @@
|
|||
android:id="@+id/scrollable_items_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"/>
|
||||
android:orientation="vertical" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
@ -27,68 +24,33 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_row_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttons_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height">
|
||||
android:layout_height="@dimen/dialog_button_ex_height"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<FrameLayout
|
||||
<include
|
||||
android:id="@+id/dismiss_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/dismiss_button_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Cancel"/>
|
||||
|
||||
</FrameLayout>
|
||||
layout="@layout/bottom_sheet_dialog_button" />
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_buttons_divider"
|
||||
android:layout_width="1dp"
|
||||
android:id="@+id/buttons_divider"
|
||||
android:layout_width="@dimen/content_padding"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
<include
|
||||
android:id="@+id/right_bottom_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
layout="@layout/bottom_sheet_dialog_button"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/right_bottom_button_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Some Action"/>
|
||||
|
||||
</FrameLayout>
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:text="You can add own modified version of routing.xml to ..osmand/files/routing/"/>
|
||||
android:text="@string/osmand_routing_promo"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
||||
android:id="@+id/menu_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -114,6 +114,11 @@
|
|||
<attr name="card_and_list_background_basic" format="reference" />
|
||||
<attr name="activity_background_basic" format="reference" />
|
||||
<attr name="pages_bg" format="reference"/>
|
||||
<attr name="dlg_btn_primary" format="reference" />
|
||||
<attr name="dlg_btn_primary_text" format="reference" />
|
||||
<attr name="dlg_btn_secondary" format="reference" />
|
||||
<attr name="dlg_btn_secondary_text" format="reference" />
|
||||
<attr name="dlg_btn_stroked" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PagerSlidingTabStrip">
|
||||
|
|
|
@ -478,12 +478,25 @@
|
|||
<color name="additional_description_light">#b3b3b3</color>
|
||||
<color name="active_buttons_and_links_light">#237bff</color>
|
||||
<color name="active_buttons_and_links_dark">#d28521</color>
|
||||
<color name="inactive_buttons_and_links_light">#cccccc</color>
|
||||
<color name="inactive_buttons_and_links_dark">#505050</color>
|
||||
<color name="active_buttons_and_links_pressed_light">#0F67EB</color>
|
||||
<color name="active_buttons_and_links_pressed_dark">#B87114</color>
|
||||
<color name="inactive_buttons_and_links_light">#F0F0F0</color>
|
||||
<color name="inactive_buttons_and_links_dark">#222526</color>
|
||||
<color name="stroked_buttons_and_links_light">#ffffff</color>
|
||||
<color name="stroked_buttons_and_links_dark">#17181A</color>
|
||||
<color name="inactive_pages_light">#cccccc</color>
|
||||
<color name="inactive_pages_dark">#505050</color>
|
||||
<color name="active_buttons_and_links_trans_light">#66237bff</color>
|
||||
<color name="active_buttons_and_links_trans_dark">#66d28521</color>
|
||||
<color name="settings_divider">#dcdcdc</color>
|
||||
<color name="profile_button_gray">#EFEFEF</color>
|
||||
<color name="profile_button_gray_pressed">#ababab</color>
|
||||
<color name="solid_ripple_color">#505050</color>
|
||||
|
||||
<color name="active_buttons_and_links_text_disabled_light">#727272</color>
|
||||
<color name="active_buttons_and_links_text_disabled_dark">#727272</color>
|
||||
<color name="active_buttons_and_links_text_light">#ffffff</color>
|
||||
<color name="active_buttons_and_links_text_dark">#cccccc</color>
|
||||
|
||||
|
||||
</resources>
|
|
@ -18,6 +18,7 @@
|
|||
<dimen name="card_button_progress_size">32dp</dimen>
|
||||
<dimen name="card_button_progress_size_small">24dp</dimen>
|
||||
<dimen name="card_padding">12dp</dimen>
|
||||
<dimen name="dlg_button_rect_rad">3dp</dimen>
|
||||
|
||||
<dimen name="widget_turn_lane_size">36dp</dimen>
|
||||
<dimen name="widget_turn_lane_border">6dp</dimen>
|
||||
|
|
|
@ -11,7 +11,12 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
|
||||
<string name="app_mode_taxi">Taxi</string>
|
||||
<string name="app_mode_shuttle_bus">Shuttle bus</string>
|
||||
<string name="app_mode_subway">Subway</string>
|
||||
<string name="app_mode_horse">Horse</string>
|
||||
<string name="app_mode_helicopter">Helicopter</string>
|
||||
<string name="osmand_routing_promo">You can add own modified version of routing.xml to ..osmand/routing</string>
|
||||
<string name="app_mode_skiing">Skiing</string>
|
||||
<string name="base_profile_descr_ski">Skiing</string>
|
||||
<string name="show_compass_ruler">Show compass ruler</string>
|
||||
|
@ -3160,6 +3165,4 @@
|
|||
<string name="routing_attr_avoid_sett_name">Avoid cobblestone and sett</string>
|
||||
<string name="routing_attr_avoid_sett_description">Avoid cobblestone and sett</string>
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -246,6 +246,11 @@
|
|||
<item name="card_and_list_background_basic">@color/card_and_list_background_light</item>
|
||||
<item name="activity_background_basic">@color/activity_background_light</item>
|
||||
<item name="pages_bg">@drawable/pages_bg_light</item>
|
||||
<item name="dlg_btn_primary">@drawable/dlg_btn_primary_light</item>
|
||||
<item name="dlg_btn_primary_text">@color/dlg_btn_primary_text_light</item>
|
||||
<item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_light</item>
|
||||
<item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_light</item>
|
||||
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_light</item>
|
||||
</style>
|
||||
|
||||
<style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow">
|
||||
|
@ -478,6 +483,11 @@
|
|||
<item name="card_and_list_background_basic">@color/card_and_list_background_dark</item>
|
||||
<item name="activity_background_basic">@color/activity_background_dark</item>
|
||||
<item name="pages_bg">@drawable/pages_bg_dark</item>
|
||||
<item name="dlg_btn_primary">@drawable/dlg_btn_primary_dark</item>
|
||||
<item name="dlg_btn_primary_text">@color/dlg_btn_primary_text_dark</item>
|
||||
<item name="dlg_btn_secondary">@drawable/dlg_btn_secondary_dark</item>
|
||||
<item name="dlg_btn_secondary_text">@color/dlg_btn_secondary_text_dark</item>
|
||||
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ListPreference
|
||||
android:key="router_service"
|
||||
android:summary="@string/router_service_descr"
|
||||
android:title="@string/router_service"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="routing_preferences"
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.database.Cursor;
|
|||
import android.database.DatabaseUtils;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.provider.Settings;
|
||||
|
||||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -34,6 +33,7 @@ public class AnalyticsHelper extends SQLiteOpenHelper {
|
|||
private final static int DATA_PARCEL_SIZE = 500; // 500 events
|
||||
private final static int SUBMIT_DATA_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||
|
||||
private final static String PARAM_OS = "os";
|
||||
private final static String PARAM_START_DATE = "startDate";
|
||||
private final static String PARAM_FINISH_DATE = "finishDate";
|
||||
private final static String PARAM_FIRST_INSTALL_DAYS = "nd";
|
||||
|
@ -153,17 +153,14 @@ public class AnalyticsHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
Map<String, String> additionalData = new LinkedHashMap<String, String>();
|
||||
additionalData.put(PARAM_OS, "android");
|
||||
additionalData.put(PARAM_START_DATE, String.valueOf(d.startDate));
|
||||
additionalData.put(PARAM_FINISH_DATE, String.valueOf(d.finishDate));
|
||||
additionalData.put(PARAM_VERSION, Version.getFullVersion(ctx));
|
||||
additionalData.put(PARAM_LANG, ctx.getLanguage() + "");
|
||||
additionalData.put(PARAM_FIRST_INSTALL_DAYS, String.valueOf(ctx.getAppInitializer().getFirstInstalledDays()));
|
||||
additionalData.put(PARAM_NUMBER_OF_STARTS, String.valueOf(ctx.getAppInitializer().getNumberOfStarts()));
|
||||
try {
|
||||
additionalData.put(PARAM_USER_ID, Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
additionalData.put(PARAM_USER_ID, ctx.getUserAndroidId());
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
for (Map.Entry<String, String> entry : additionalData.entrySet()) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package net.osmand.plus;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
@ -469,7 +471,7 @@ public class ApplicationMode {
|
|||
@Expose private final String stringKey;
|
||||
@Expose private String userProfileName;
|
||||
@Expose private ApplicationMode parent;
|
||||
@Expose private String iconName = "R.drawable.map_world_globe_dark";
|
||||
@Expose private String iconName = "map_world_globe_dark";
|
||||
@Expose private int mapIconId = R.drawable.map_world_globe_dark;
|
||||
@Expose private int smallIconDark = R.drawable.ic_world_globe_dark;
|
||||
@Expose private float defaultSpeed = 10f;
|
||||
|
@ -547,11 +549,11 @@ public class ApplicationMode {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static int getIconResFromName(Context app, String variableName, String packageName) {
|
||||
@DrawableRes public int getIconRes(Context app) {
|
||||
try {
|
||||
return app.getResources().getIdentifier(variableName, "drawable", packageName);
|
||||
return app.getResources().getIdentifier(iconName, "drawable", app.getPackageName());
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
return R.drawable.map_world_globe_dark;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -15,6 +16,7 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.support.multidex.MultiDex;
|
||||
import android.support.multidex.MultiDexApplication;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -77,6 +79,7 @@ import java.io.PrintStream;
|
|||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
import btools.routingapp.BRouterServiceConnection;
|
||||
import btools.routingapp.IBRouterService;
|
||||
|
@ -919,6 +922,24 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
public String getUserAndroidId() {
|
||||
String userAndroidId = osmandSettings.USER_ANDROID_ID.get();
|
||||
if (!Algorithms.isEmpty(userAndroidId)) {
|
||||
return userAndroidId;
|
||||
}
|
||||
try {
|
||||
userAndroidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
if (userAndroidId == null || userAndroidId.length() < 16 || userAndroidId.equals("0000000000000000")) {
|
||||
userAndroidId = UUID.randomUUID().toString();
|
||||
}
|
||||
osmandSettings.USER_ANDROID_ID.set(userAndroidId);
|
||||
return userAndroidId;
|
||||
}
|
||||
|
||||
public void logEvent(String event) {
|
||||
try {
|
||||
if (osmandSettings.SEND_ANONYMOUS_APP_USAGE_DATA.get()) {
|
||||
|
@ -939,6 +960,16 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
}
|
||||
}
|
||||
|
||||
public void logMapDownloadEvent(String event, IndexItem item, long time) {
|
||||
try {
|
||||
if (osmandSettings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get()) {
|
||||
analyticsHelper.addEvent("map_download_" + event + ": " + item.getFileName() + " in " + time + " msec");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void restartApp(Context ctx) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(ctx);
|
||||
bld.setMessage(R.string.restart_is_required);
|
||||
|
@ -981,6 +1012,8 @@ public class OsmandApplication extends MultiDexApplication {
|
|||
PlatformUtil.getLog(ErrorBottomSheetDialog.class).error("", e);
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_TEXT, text.toString());
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.send_report)));
|
||||
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.send_report));
|
||||
chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(chooserIntent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1172,6 +1172,7 @@ public class OsmandSettings {
|
|||
public final CommonPreference<Boolean> ENABLE_PROXY = new BooleanPreference("enable_proxy", false).makeGlobal();
|
||||
public final CommonPreference<String> PROXY_HOST = new StringPreference("proxy_host", "127.0.0.1").makeGlobal();
|
||||
public final CommonPreference<Integer> PROXY_PORT = new IntPreference("proxy_port", 8118).makeGlobal();
|
||||
public final CommonPreference<String> USER_ANDROID_ID = new StringPreference("user_android_id", "").makeGlobal();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String SAVE_CURRENT_TRACK = "save_current_track"; //$NON-NLS-1$
|
||||
|
|
|
@ -366,7 +366,7 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
|
|||
: String.format(getString(R.string.profile_type_descr_string),
|
||||
am.getParent().toHumanString(getMyApplication())),
|
||||
am.getStringKey(),
|
||||
ApplicationMode.getIconResFromName(getMyApplication(), am.getIconName(), getApplication().getPackageName()),
|
||||
am.getIconRes(getMyApplication()),
|
||||
isSelected
|
||||
));
|
||||
}
|
||||
|
|
|
@ -83,14 +83,12 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
addPreferencesFromResource(R.xml.navigation_settings);
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
settings = getMyApplication().getSettings();
|
||||
routerServicePreference = (ListPreference) screen.findPreference(settings.ROUTER_SERVICE.getId());
|
||||
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
|
||||
String[] entries = new String[vls.length];
|
||||
for(int i=0; i<entries.length; i++){
|
||||
entries[i] = vls[i].getName();
|
||||
}
|
||||
registerListPreference(settings.ROUTER_SERVICE, screen, entries, vls);
|
||||
|
||||
|
||||
registerBooleanPreference(settings.SNAP_TO_ROAD, screen);
|
||||
|
||||
Integer[] intValues = new Integer[] { 0, 5, 10, 15, 20, 25, 30, 45, 60, 90};
|
||||
|
@ -365,7 +363,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
prepareRoutingPrefs(getPreferenceScreen());
|
||||
reloadVoiceListPreference(getPreferenceScreen());
|
||||
super.updateAllSettings();
|
||||
routerServicePreference.setSummary(getString(R.string.router_service_descr) + " [" + settings.ROUTER_SERVICE.get() + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -386,12 +383,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
return true;
|
||||
}
|
||||
super.onPreferenceChange(preference, newValue);
|
||||
if (id.equals(settings.ROUTER_SERVICE.getId())) {
|
||||
routerServicePreference.setSummary(getString(R.string.router_service_descr) + " ["
|
||||
+ settings.ROUTER_SERVICE.get() + "]");
|
||||
prepareRoutingPrefs(getPreferenceScreen());
|
||||
super.updateAllSettings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@ import android.view.View;
|
|||
import android.view.WindowManager;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
|
@ -447,7 +447,7 @@ public class TrackActivity extends TabActivity {
|
|||
result = app.getSavingTrackHelper().getCurrentGpx();
|
||||
} else {
|
||||
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(file.getAbsolutePath());
|
||||
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() != null) {
|
||||
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() != null && selectedGpxFile.getGpxFile().modifiedTime == file.lastModified()) {
|
||||
result = selectedGpxFile.getGpxFile();
|
||||
} else {
|
||||
result = GPXUtilities.loadGPXFile(file);
|
||||
|
@ -472,8 +472,16 @@ public class TrackActivity extends TabActivity {
|
|||
TrackActivity activity = getTrackActivity();
|
||||
if (activity != null) {
|
||||
activity.setSupportProgressBarIndeterminateVisibility(false);
|
||||
if (showTemporarily && result != null) {
|
||||
app.getSelectedGpxHelper().selectGpxFile(result, false, false);
|
||||
if (result != null) {
|
||||
final GpxSelectionHelper helper = app.getSelectedGpxHelper();
|
||||
if (showTemporarily) {
|
||||
helper.selectGpxFile(result, false, false);
|
||||
} else {
|
||||
final SelectedGpxFile selectedGpx = helper.getSelectedFileByPath(result.path);
|
||||
if (selectedGpx != null && result.error == null) {
|
||||
selectedGpx.setGpxFile(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!activity.stopped) {
|
||||
activity.onGPXFileReady(result);
|
||||
|
|
|
@ -86,15 +86,15 @@ public class AppModeDialog {
|
|||
final boolean checked = selected.contains(mode);
|
||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||
if (checked) {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), R.color.description_font_and_bottom_sheet_icons));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), R.color.description_font_and_bottom_sheet_icons));
|
||||
iv.setBackgroundResource(AndroidUtils.resolveAttribute(ctx, android.R.attr.selectableItemBackground));
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getIconRes(ctx)));
|
||||
}
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
||||
|
@ -138,7 +138,7 @@ public class AppModeDialog {
|
|||
View selection = tb.findViewById(R.id.selection);
|
||||
|
||||
if (checked) {
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
iv.setImageDrawable(drawable);
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||
|
||||
|
@ -150,9 +150,9 @@ public class AppModeDialog {
|
|||
}
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
Drawable active = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
Drawable active = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
drawable = AndroidUtils.createPressedStateListDrawable(drawable, active);
|
||||
}
|
||||
iv.setImageDrawable(drawable);
|
||||
|
@ -163,7 +163,7 @@ public class AppModeDialog {
|
|||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.btn_border_pressed_trans_light, R.drawable.btn_border_pressed_trans_dark);
|
||||
}
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getIconRes(ctx)));
|
||||
}
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ public class AppModeDialog {
|
|||
int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
|
||||
View tb = layoutInflater.inflate(layoutId, null);
|
||||
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), isNightMode(ctx, useMapTheme) ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), isNightMode(ctx, useMapTheme) ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setContentDescription(mode.toHumanString(ctx));
|
||||
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
|
||||
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);
|
||||
|
|
|
@ -75,6 +75,11 @@ public abstract class BottomSheetDialogFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
protected OsmandApplication requiredMyApplication() {
|
||||
return (OsmandApplication) requireActivity().getApplication();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Drawable getIcon(@DrawableRes int drawableRes, @ColorRes int color) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -10,6 +11,7 @@ import android.support.annotation.DrawableRes;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -19,13 +21,13 @@ import android.view.ViewTreeObserver;
|
|||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -44,6 +46,12 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
|
||||
private LinearLayout itemsContainer;
|
||||
|
||||
public enum DialogButtonType {
|
||||
PRIMARY,
|
||||
SECONDARY,
|
||||
STROKED
|
||||
}
|
||||
|
||||
@StringRes
|
||||
protected int dismissButtonStringRes = R.string.shared_string_cancel;
|
||||
|
||||
|
@ -57,7 +65,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
if (savedInstanceState != null) {
|
||||
usedOnMap = savedInstanceState.getBoolean(USED_ON_MAP_KEY);
|
||||
}
|
||||
nightMode = isNightMode();
|
||||
nightMode = isNightMode(requiredMyApplication());
|
||||
themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
}
|
||||
|
||||
|
@ -65,10 +73,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||
createMenuItems(savedInstanceState);
|
||||
|
||||
OsmandApplication app = getMyApplication();
|
||||
|
||||
View mainView = View.inflate(new ContextThemeWrapper(app, themeRes), R.layout.bottom_sheet_menu_base, null);
|
||||
Context ctx = requireContext();
|
||||
View mainView = View.inflate(new ContextThemeWrapper(ctx, themeRes), R.layout.bottom_sheet_menu_base, null);
|
||||
if (useScrollableItemsContainer()) {
|
||||
itemsContainer = (LinearLayout) mainView.findViewById(R.id.scrollable_items_container);
|
||||
} else {
|
||||
|
@ -79,12 +85,9 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
|
||||
inflateMenuItems();
|
||||
|
||||
int bottomDividerColorId = getBottomDividerColorId();
|
||||
if (bottomDividerColorId != DEFAULT_VALUE) {
|
||||
mainView.findViewById(R.id.bottom_row_divider).setBackgroundColor(getResolvedColor(bottomDividerColorId));
|
||||
}
|
||||
|
||||
mainView.findViewById(R.id.dismiss_button).setOnClickListener(new View.OnClickListener() {
|
||||
View dismissButton = mainView.findViewById(R.id.dismiss_button);
|
||||
setupDialogButton(dismissButton, DialogButtonType.STROKED, getDismissButtonTextId());
|
||||
dismissButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onDismissButtonClickAction();
|
||||
|
@ -92,19 +95,13 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
}
|
||||
});
|
||||
if (hideButtonsContainer()) {
|
||||
mainView.findViewById(R.id.bottom_row_divider).setVisibility(View.GONE);
|
||||
mainView.findViewById(R.id.buttons_container).setVisibility(View.GONE);
|
||||
} else {
|
||||
((TextView) mainView.findViewById(R.id.dismiss_button_text)).setText(getDismissButtonTextId());
|
||||
|
||||
int rightBottomButtonTextId = getRightBottomButtonTextId();
|
||||
if (rightBottomButtonTextId != DEFAULT_VALUE) {
|
||||
View buttonsDivider = mainView.findViewById(R.id.bottom_buttons_divider);
|
||||
buttonsDivider.setVisibility(View.VISIBLE);
|
||||
if (bottomDividerColorId != DEFAULT_VALUE) {
|
||||
buttonsDivider.setBackgroundColor(getResolvedColor(bottomDividerColorId));
|
||||
}
|
||||
mainView.findViewById(R.id.buttons_divider).setVisibility(View.VISIBLE);
|
||||
View rightButton = mainView.findViewById(R.id.right_bottom_button);
|
||||
setupDialogButton(rightButton, DialogButtonType.PRIMARY, rightBottomButtonTextId);
|
||||
rightButton.setVisibility(View.VISIBLE);
|
||||
rightButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -112,23 +109,23 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
onRightBottomButtonClick();
|
||||
}
|
||||
});
|
||||
((TextView) rightButton.findViewById(R.id.right_bottom_button_text)).setText(rightBottomButtonTextId);
|
||||
}
|
||||
}
|
||||
|
||||
setupHeightAndBackground(mainView);
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
FragmentActivity activity = requireActivity();
|
||||
if (!AndroidUiHelper.isOrientationPortrait(activity)) {
|
||||
final Window window = getDialog().getWindow();
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
|
||||
window.setAttributes(params);
|
||||
if (window != null) {
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = activity.getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width);
|
||||
window.setAttributes(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,9 +144,41 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
}
|
||||
}
|
||||
|
||||
private void setupDialogButton(View buttonView, DialogButtonType buttonType, @StringRes int buttonTextId) {
|
||||
Context ctx = buttonView.getContext();
|
||||
TextViewEx buttonTextView = (TextViewEx) buttonView.findViewById(R.id.button_text);
|
||||
boolean v21 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
View buttonContainer = buttonView.findViewById(R.id.button_container);
|
||||
switch (buttonType) {
|
||||
case PRIMARY:
|
||||
if (v21) {
|
||||
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_solid_light, R.drawable.ripple_solid_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_primary_light, R.drawable.dlg_btn_primary_dark);
|
||||
buttonTextView.setTextColor(ContextCompat.getColorStateList(ctx, nightMode ? R.color.dlg_btn_primary_text_dark : R.color.dlg_btn_primary_text_light));
|
||||
break;
|
||||
case SECONDARY:
|
||||
if (v21) {
|
||||
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_solid_light, R.drawable.ripple_solid_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_secondary_light, R.drawable.dlg_btn_secondary_dark);
|
||||
buttonTextView.setTextColor(ContextCompat.getColorStateList(ctx, nightMode ? R.color.dlg_btn_secondary_text_dark : R.color.dlg_btn_secondary_text_light));
|
||||
break;
|
||||
case STROKED:
|
||||
if (v21) {
|
||||
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_stroked_light, R.drawable.dlg_btn_stroked_dark);
|
||||
buttonTextView.setTextColor(ContextCompat.getColorStateList(ctx, nightMode ? R.color.dlg_btn_secondary_text_dark : R.color.dlg_btn_secondary_text_light));
|
||||
break;
|
||||
}
|
||||
buttonTextView.setText(buttonTextId);
|
||||
buttonTextView.setEnabled(buttonView.isEnabled());
|
||||
}
|
||||
|
||||
public abstract void createMenuItems(Bundle savedInstanceState);
|
||||
|
||||
protected void inflateMenuItems(){
|
||||
protected void inflateMenuItems() {
|
||||
OsmandApplication app = getMyApplication();
|
||||
for (BaseBottomSheetItem item : items) {
|
||||
item.inflate(app, itemsContainer, nightMode);
|
||||
|
@ -172,7 +201,8 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
|
||||
@ColorInt
|
||||
protected int getResolvedColor(@ColorRes int colorId) {
|
||||
return ContextCompat.getColor(getContext(), colorId);
|
||||
Context ctx = getContext();
|
||||
return ctx != null ? ContextCompat.getColor(ctx, colorId) : 0;
|
||||
}
|
||||
|
||||
protected void setupHeightAndBackground(final View mainView) {
|
||||
|
@ -187,6 +217,13 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
ViewTreeObserver obs = mainView.getViewTreeObserver();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
obs.removeOnGlobalLayoutListener(this);
|
||||
} else {
|
||||
obs.removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
|
||||
final View contentView = useScrollableItemsContainer() ? mainView.findViewById(R.id.scroll_view) : itemsContainer;
|
||||
if (contentView.getHeight() > contentHeight) {
|
||||
if (useScrollableItemsContainer()) {
|
||||
|
@ -207,22 +244,13 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
} else {
|
||||
mainView.setBackgroundResource(showTopShadow ? getLandscapeTopsidesBgResId() : getLandscapeSidesBgResId());
|
||||
}
|
||||
|
||||
ViewTreeObserver obs = mainView.getViewTreeObserver();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
obs.removeOnGlobalLayoutListener(this);
|
||||
} else {
|
||||
obs.removeGlobalOnLayoutListener(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int getContentHeight(int availableScreenHeight) {
|
||||
int customHeight = getCustomHeight();
|
||||
int maxHeight = availableScreenHeight
|
||||
- AndroidUtils.dpToPx(getContext(), 1) // divider height
|
||||
- getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height);
|
||||
int maxHeight = availableScreenHeight - getResources().getDimensionPixelSize(R.dimen.dialog_button_ex_height);
|
||||
if (customHeight != DEFAULT_VALUE && customHeight <= maxHeight) {
|
||||
return customHeight;
|
||||
}
|
||||
|
@ -242,7 +270,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
}
|
||||
|
||||
@ColorRes
|
||||
protected int getBottomDividerColorId() {
|
||||
protected int getDividerColorId() {
|
||||
return DEFAULT_VALUE;
|
||||
}
|
||||
|
||||
|
@ -288,10 +316,10 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
|||
return nightMode ? R.drawable.bg_bottom_sheet_sides_landscape_dark : R.drawable.bg_bottom_sheet_sides_landscape_light;
|
||||
}
|
||||
|
||||
private boolean isNightMode() {
|
||||
private boolean isNightMode(@NonNull OsmandApplication app) {
|
||||
if (usedOnMap) {
|
||||
return getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
return app.getDaynightHelper().isNightModeForMapControls();
|
||||
}
|
||||
return !getMyApplication().getSettings().isLightContent();
|
||||
return !app.getSettings().isLightContent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
|||
.create();
|
||||
items.add(replaceStartItem);
|
||||
|
||||
items.add(new DividerHalfItem(getContext(), getBottomDividerColorId()));
|
||||
items.add(new DividerHalfItem(getContext(), getDividerColorId()));
|
||||
|
||||
BaseBottomSheetItem subsequentDestItem = new BottomSheetItemWithDescription.Builder()
|
||||
.setDescription(getString(R.string.subsequent_dest_description))
|
||||
|
@ -130,7 +130,7 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
|||
}
|
||||
|
||||
@Override
|
||||
protected int getBottomDividerColorId() {
|
||||
protected int getDividerColorId() {
|
||||
return nightMode ? R.color.route_info_bottom_view_bg_dark : -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -534,7 +534,6 @@ public class DownloadIndexesThread {
|
|||
boolean result = downloadFile(item, filesToReindex, forceWifi);
|
||||
success = result || success;
|
||||
if (result) {
|
||||
checkDownload(item);
|
||||
if (DownloadActivityType.isCountedInDownloads(item)) {
|
||||
downloads.set(downloads.get() + 1);
|
||||
}
|
||||
|
@ -664,8 +663,16 @@ public class DownloadIndexesThread {
|
|||
LOG.error("Copy exception", e);
|
||||
}
|
||||
} else {
|
||||
long start = System.currentTimeMillis();
|
||||
app.logMapDownloadEvent("start", item);
|
||||
res = downloadFileHelper.downloadFile(de, this, filesToReindex, this, forceWifi);
|
||||
long time = System.currentTimeMillis() - start;
|
||||
if (res) {
|
||||
app.logMapDownloadEvent("done", item, time);
|
||||
checkDownload(item);
|
||||
} else {
|
||||
app.logMapDownloadEvent("failed", item, time);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -678,7 +685,6 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
|
||||
private void checkDownload(IndexItem item) {
|
||||
app.logMapDownloadEvent("done", item);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("file_name", item.fileName);
|
||||
params.put("file_size", item.size);
|
||||
|
|
|
@ -7,7 +7,6 @@ import android.content.res.Resources;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -28,10 +27,10 @@ import android.widget.TextView;
|
|||
|
||||
import net.osmand.AndroidNetworkUtils;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
|
||||
|
@ -283,7 +282,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
protected String doInBackground(Void... params) {
|
||||
try {
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put("aid", Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
parameters.put("aid", getMyApplication().getUserAndroidId());
|
||||
parameters.put("email", email);
|
||||
|
||||
return AndroidNetworkUtils.sendRequest(getMyApplication(),
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
@ -677,11 +676,7 @@ public class InAppPurchaseHelper {
|
|||
parameters.put("lang", ctx.getLanguage() + "");
|
||||
parameters.put("nd", ctx.getAppInitializer().getFirstInstalledDays() + "");
|
||||
parameters.put("ns", ctx.getAppInitializer().getNumberOfStarts() + "");
|
||||
try {
|
||||
parameters.put("aid", Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
parameters.put("aid", ctx.getUserAndroidId());
|
||||
}
|
||||
|
||||
// Callback for when a purchase is finished
|
||||
|
|
|
@ -75,8 +75,9 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
|||
|
||||
TextView appModeTv = (TextView) mainView.findViewById(R.id.app_mode_text_view);
|
||||
ApplicationMode appMode = settings.APPLICATION_MODE.get();
|
||||
appModeTv.setText(appMode.getStringResource());
|
||||
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(appMode.getSmallIconDark()), null);
|
||||
appModeTv.setText(appMode.toHumanString(getContext()));
|
||||
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(
|
||||
appMode.getIconRes(getMyApplication())), null);
|
||||
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
((ObservableScrollView) mainView.findViewById(R.id.scroll_view)).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
|
||||
|
|
|
@ -661,7 +661,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
if (mapActivity != null) {
|
||||
final ImageButton appModesBtn = (ImageButton) mapActivity.findViewById(R.id.snap_to_road_image_button);
|
||||
appModesBtn.setBackgroundResource(nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle);
|
||||
appModesBtn.setImageDrawable(getActiveIcon(planRouteContext.getSnappedMode().getMapIconId()));
|
||||
appModesBtn.setImageDrawable(getActiveIcon(planRouteContext.getSnappedMode().getIconRes(getMyApplication())));
|
||||
appModesBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -805,7 +805,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
ImageButton snapToRoadBtn = (ImageButton) mapActivity.findViewById(R.id.snap_to_road_image_button);
|
||||
snapToRoadBtn.setBackgroundResource(nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle);
|
||||
snapToRoadBtn.setImageDrawable(getActiveIcon(appMode.getMapIconId()));
|
||||
snapToRoadBtn.setImageDrawable(getActiveIcon(appMode.getIconRes(getMyApplication())));
|
||||
snapToRoadBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -95,7 +95,8 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
|
|||
for (int i = 0; i < modes.size(); i++) {
|
||||
ApplicationMode mode = modes.get(i);
|
||||
View row = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.list_item_icon_and_title, null);
|
||||
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(getContentIcon(mode.getSmallIconDark()));
|
||||
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(
|
||||
getContentIcon(mode.getIconRes(getMyApplication())));
|
||||
((TextView) row.findViewById(R.id.title)).setText(mode.toHumanString(getContext()));
|
||||
row.setOnClickListener(onClickListener);
|
||||
row.setTag(i);
|
||||
|
|
|
@ -55,8 +55,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent,
|
||||
Bundle savedInstanceState) {
|
||||
themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
adapter = new ProfileMenuAdapter(allModes, selectedModes, getMyApplication(), listener);
|
||||
adapter.setBottomSheetMode(true);
|
||||
adapter = new ProfileMenuAdapter(allModes, selectedModes, getMyApplication(), listener, true);
|
||||
recyclerView = new RecyclerView(getContext());
|
||||
recyclerView = (RecyclerView) View
|
||||
.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.recyclerview, null);
|
||||
|
@ -128,13 +127,6 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
|||
|
||||
items.add(new TitleItem(getString(R.string.application_profiles)));
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(recyclerView).create());
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(textButtonView)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getContext(), SettingsProfileActivity.class));
|
||||
}
|
||||
}).create());
|
||||
}
|
||||
|
||||
public void setUpdateMapRouteMenuListener(
|
||||
|
|
|
@ -713,18 +713,20 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
|
||||
Map<String, GeneralRouter> inputProfiles = context.getRoutingConfig().getAllRouters();
|
||||
for (Entry<String, GeneralRouter> e : inputProfiles.entrySet()) {
|
||||
int iconRes = R.drawable.ic_action_gdirections_dark;
|
||||
String name = e.getValue().getProfileName();
|
||||
String description = context.getString(R.string.osmand_default_routing);
|
||||
if (!Algorithms.isEmpty(e.getValue().getFilename())) {
|
||||
description = e.getValue().getFilename();
|
||||
} else if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
|
||||
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
|
||||
name = context
|
||||
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
|
||||
if (!e.getKey().equals("geocoding")) {
|
||||
int iconRes = R.drawable.ic_action_gdirections_dark;
|
||||
String name = e.getValue().getProfileName();
|
||||
String description = context.getString(R.string.osmand_default_routing);
|
||||
if (!Algorithms.isEmpty(e.getValue().getFilename())) {
|
||||
description = e.getValue().getFilename();
|
||||
} else if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
|
||||
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
|
||||
name = context
|
||||
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
|
||||
}
|
||||
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
|
||||
iconRes, false, e.getValue().getFilename()));
|
||||
}
|
||||
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
|
||||
iconRes, false, e.getValue().getFilename()));
|
||||
}
|
||||
return profilesObjects;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.profiles;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -11,6 +12,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -22,17 +24,18 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder> {
|
||||
|
||||
private List<ApplicationMode> items;
|
||||
private List<Object> items = new ArrayList<>();
|
||||
private Set<ApplicationMode> selectedItems;
|
||||
private ProfileListener listener;
|
||||
private final OsmandApplication app;
|
||||
@ColorRes
|
||||
private int selectedIconColorRes;
|
||||
private boolean isBottomSheet = false;
|
||||
private static final String MANAGE_BTN = "manage_button";
|
||||
|
||||
public ProfileMenuAdapter(List<ApplicationMode> items, Set<ApplicationMode> selectedItems,
|
||||
OsmandApplication app, ProfileListener listener) {
|
||||
this.items = items;
|
||||
this.items.addAll(items);
|
||||
this.listener = listener;
|
||||
this.app = app;
|
||||
this.selectedItems = selectedItems;
|
||||
|
@ -41,7 +44,20 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
: R.color.active_buttons_and_links_light;
|
||||
}
|
||||
|
||||
public List<ApplicationMode> getItems() {
|
||||
public ProfileMenuAdapter(List<ApplicationMode> items, Set<ApplicationMode> selectedItems,
|
||||
OsmandApplication app, ProfileListener listener, boolean isBottomSheet) {
|
||||
this.items.addAll(items);
|
||||
this.items.add(MANAGE_BTN);
|
||||
this.listener = listener;
|
||||
this.app = app;
|
||||
this.selectedItems = selectedItems;
|
||||
this.isBottomSheet = isBottomSheet;
|
||||
selectedIconColorRes = isNightMode(app)
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light;
|
||||
}
|
||||
|
||||
public List<Object> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
|
@ -50,10 +66,6 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setBottomSheetMode(boolean isBottomSheet) {
|
||||
this.isBottomSheet = isBottomSheet;
|
||||
}
|
||||
|
||||
public void setListener(ProfileListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
@ -62,10 +74,18 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
items.clear();
|
||||
this.selectedItems.clear();
|
||||
items.addAll(newList);
|
||||
if (isBottomSheet) {
|
||||
items.add(MANAGE_BTN);
|
||||
}
|
||||
this.selectedItems.addAll(selectedItems);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ProfileViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
@ -76,64 +96,90 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final ProfileViewHolder holder, int position) {
|
||||
final ApplicationMode item = items.get(position);
|
||||
Object obj = items.get(position);
|
||||
|
||||
if (isBottomSheet) {
|
||||
holder.divider.setBackgroundColor(isNightMode(app)
|
||||
? app.getResources().getColor(R.color.divider_dark)
|
||||
: app.getResources().getColor(R.color.divider_light));
|
||||
}
|
||||
if (obj instanceof ApplicationMode) {
|
||||
holder.divider.setVisibility(View.VISIBLE);
|
||||
holder.icon.setVisibility(View.VISIBLE);
|
||||
holder.descr.setVisibility(View.VISIBLE);
|
||||
holder.aSwitch.setVisibility(View.VISIBLE);
|
||||
holder.menuIcon.setVisibility(View.VISIBLE);
|
||||
final ApplicationMode item = (ApplicationMode) obj;
|
||||
if (isBottomSheet) {
|
||||
holder.divider.setBackgroundColor(isNightMode(app)
|
||||
? app.getResources().getColor(R.color.divider_dark)
|
||||
: app.getResources().getColor(R.color.divider_light));
|
||||
}
|
||||
|
||||
if (item.getParent() != null) {
|
||||
holder.title.setText(item.getUserProfileName());
|
||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(
|
||||
item.getParent().getStringKey().replace("_", " "))));
|
||||
} else {
|
||||
holder.title.setText(app.getResources().getString(item.getStringResource()));
|
||||
holder.descr.setText(R.string.profile_type_base_string);
|
||||
}
|
||||
if (item.getParent() != null) {
|
||||
holder.title.setText(item.getUserProfileName());
|
||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(
|
||||
item.getParent().getStringKey().replace("_", " "))));
|
||||
} else {
|
||||
holder.title.setText(item.getStringResource());
|
||||
holder.descr.setText(R.string.profile_type_base_string);
|
||||
}
|
||||
|
||||
holder.title.setTextColor(app.getResources().getColor(isNightMode(app)
|
||||
? R.color.main_font_dark
|
||||
: R.color.main_font_light));
|
||||
holder.title.setTextColor(app.getResources().getColor(isNightMode(app)
|
||||
? R.color.main_font_dark
|
||||
: R.color.main_font_light));
|
||||
|
||||
int iconRes = item.getParent() == null
|
||||
? item.getSmallIconDark()
|
||||
: ApplicationMode.getIconResFromName(app, item.getIconName(), app.getPackageName());
|
||||
int iconRes = item.getParent() == null
|
||||
? item.getSmallIconDark()
|
||||
: item.getIconRes(app);
|
||||
|
||||
if (iconRes == 0 || iconRes == -1) {
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
}
|
||||
if (iconRes == 0 || iconRes == -1) {
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
}
|
||||
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.aSwitch.setChecked(true);
|
||||
holder.icon
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(iconRes, selectedIconColorRes));
|
||||
} else {
|
||||
holder.aSwitch.setChecked(false);
|
||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color));
|
||||
}
|
||||
final int ficon = iconRes;
|
||||
|
||||
holder.aSwitch.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.changeProfileStatus(item, holder.aSwitch.isChecked());
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.icon.setImageDrawable(app.getUIUtilities()
|
||||
.getIcon(item.getSmallIconDark(), selectedIconColorRes));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(
|
||||
app.getUIUtilities().getIcon(item.getSmallIconDark(), R.color.icon_color));
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.aSwitch.setChecked(true);
|
||||
holder.icon
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(iconRes, selectedIconColorRes));
|
||||
} else {
|
||||
holder.aSwitch.setChecked(false);
|
||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color));
|
||||
}
|
||||
|
||||
holder.aSwitch.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.changeProfileStatus(item, holder.aSwitch.isChecked());
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.icon.setImageDrawable(app.getUIUtilities()
|
||||
.getIcon(ficon, selectedIconColorRes));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(
|
||||
app.getUIUtilities().getIcon(ficon, R.color.icon_color));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.editProfile(item);
|
||||
}
|
||||
});
|
||||
});
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.editProfile(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final String title = (String) obj;
|
||||
if (title.equals("manage_button"))
|
||||
holder.divider.setVisibility(View.INVISIBLE);
|
||||
holder.icon.setVisibility(View.INVISIBLE);
|
||||
holder.descr.setVisibility(View.GONE);
|
||||
holder.aSwitch.setVisibility(View.GONE);
|
||||
holder.menuIcon.setVisibility(View.GONE);
|
||||
holder.title.setTextColor(app.getResources().getColor(selectedIconColorRes));
|
||||
holder.title.setText(R.string.shared_string_manage);
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
app.startActivity(new Intent(app, SettingsProfileActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +195,7 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
|
||||
TextView title, descr;
|
||||
SwitchCompat aSwitch;
|
||||
ImageView icon;
|
||||
ImageView icon, menuIcon;
|
||||
LinearLayout profileOptions;
|
||||
View divider;
|
||||
|
||||
|
@ -161,6 +207,7 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
icon = itemView.findViewById(R.id.icon);
|
||||
profileOptions = itemView.findViewById(R.id.profile_settings);
|
||||
divider = itemView.findViewById(R.id.divider_bottom);
|
||||
menuIcon = itemView.findViewById(R.id.menu_image);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
private SelectProfileListener listener;
|
||||
|
||||
private final List<ProfileDataObject> profiles = new ArrayList<>();
|
||||
private final List<ApplicationMode> appModes = new ArrayList<>();
|
||||
private final Set<ApplicationMode> activeAppModes = new HashSet<>();
|
||||
|
||||
private List<IconResWithDescr> icons;
|
||||
private String selectedItemKey;
|
||||
|
@ -82,6 +80,12 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
if (type.equals(TYPE_NAV_PROFILE) || type.equals(TYPE_BASE_APP_PROFILE)) {
|
||||
if (items.get(items.size()-1).getView() != null) {
|
||||
items.get(items.size()-1).getView().findViewById(R.id.divider_bottom).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,9 +178,7 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
for (final IconResWithDescr icon : icons) {
|
||||
Drawable drawableIcon;
|
||||
boolean isSelected = icon.resStringId.equals(selectedIconRes);
|
||||
int iconRes = ApplicationMode
|
||||
.getIconResFromName(getMyApplication(), icon.resStringId,
|
||||
getMyApplication().getPackageName());
|
||||
int iconRes = icon.resId;
|
||||
if (isSelected) {
|
||||
drawableIcon = getMyApplication().getUIUtilities()
|
||||
.getIcon(iconRes, nightMode
|
||||
|
@ -235,15 +237,20 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
private List<IconResWithDescr> getProfileIcons() {
|
||||
List<IconResWithDescr> icons = new ArrayList<>();
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_car_dark, R.string.rendering_value_car_name, "ic_action_car_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_bicycle_dark, R.string.rendering_value_bicycle_name, "ic_action_bicycle_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_pedestrian_dark, R.string.rendering_value_pedestrian_name,"ic_action_pedestrian_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_bus_dark, R.string.app_mode_bus, "ic_action_bus_dark",false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_sail_boat_dark, R.string.app_mode_boat, "ic_action_sail_boat_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_aircraft, R.string.app_mode_aircraft, "ic_action_aircraft", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_taxi, R.string.app_mode_taxi, "ic_action_taxi", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_truck_dark, R.string.app_mode_truck, "ic_action_truck_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_shuttle_bus, R.string.app_mode_shuttle_bus, "ic_action_shuttle_bus", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_bus_dark, R.string.app_mode_bus, "ic_action_bus_dark",false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_subway, R.string.app_mode_subway, "ic_action_subway", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_motorcycle_dark, R.string.app_mode_motorcycle, "ic_action_motorcycle_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_bicycle_dark, R.string.rendering_value_bicycle_name, "ic_action_bicycle_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_horse, R.string.app_mode_horse, "ic_action_horse", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_pedestrian_dark, R.string.rendering_value_pedestrian_name,"ic_action_pedestrian_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_trekking_dark, R.string.app_mode_hiking, "ic_action_trekking_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_plugin_skimaps, R.string.routing_profile_ski, "ic_plugin_skimaps", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_sail_boat_dark, R.string.app_mode_boat, "ic_action_sail_boat_dark", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_aircraft, R.string.app_mode_aircraft, "ic_action_aircraft", false));
|
||||
icons.add(new IconResWithDescr(R.drawable.ic_action_helicopter, R.string.app_mode_helicopter, "ic_action_helicopter", false));
|
||||
return icons;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -84,7 +85,7 @@ public class NavStartStopAction extends QuickAction {
|
|||
if (!helper.isRoutePlanningMode() && !helper.isFollowingMode()) {
|
||||
return ((MapActivity) context).getMapActions().getRouteMode(null).getSmallIconDark();
|
||||
}
|
||||
return helper.getAppMode().getSmallIconDark();
|
||||
return helper.getAppMode().getIconRes(context);
|
||||
}
|
||||
return super.getIconRes(context);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
private Bitmap bigIconBg;
|
||||
private Bitmap bigIconBgStale;
|
||||
private Bitmap bigIconBgSelected;
|
||||
private Bitmap bigIconBgSelectedStale;
|
||||
private Bitmap placeholder;
|
||||
|
||||
private int smallIconSize;
|
||||
|
@ -112,6 +113,8 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
? R.drawable.map_pin_user_stale_location_night : R.drawable.map_pin_user_stale_location_day);
|
||||
bigIconBgSelected = BitmapFactory.decodeResource(res, night
|
||||
? R.drawable.map_pin_user_location_selected_night : R.drawable.map_pin_user_location_selected_day);
|
||||
bigIconBgSelectedStale = BitmapFactory.decodeResource(res, night
|
||||
? R.drawable.map_pin_user_stale_location_selected_night : R.drawable.map_pin_user_stale_location_selected_day);
|
||||
placeholder = BitmapFactory.decodeResource(res, R.drawable.img_user_picture);
|
||||
|
||||
smallIconSize = AndroidUtils.dpToPx(map, SMALL_ICON_SIZE_DP);
|
||||
|
@ -171,7 +174,8 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
image = placeholder;
|
||||
}
|
||||
if (selected) {
|
||||
drawBigIcon(canvas, x, y, image, bigIconBgSelected);
|
||||
Bitmap bg = isStale(point) ? bigIconBgSelectedStale : bigIconBgSelected;
|
||||
drawBigIcon(canvas, x, y, image, bg);
|
||||
} else if (pointsType == PointsType.STANDARD) {
|
||||
int radius = getRadiusPoi(tb);
|
||||
float density = tb.getDensity();
|
||||
|
|