This commit is contained in:
Denis 2015-02-06 13:19:57 +02:00
commit 4997d984f8
64 changed files with 661 additions and 263 deletions

3
.gitignore vendored
View file

@ -29,5 +29,8 @@ out/
# MacOSX
.DS_Store
# Windows
Thumbs.db
# Output files
/build

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:state_pressed="false" android:color="#77848c" />
<item android:state_checked="false" android:state_pressed="true" android:color="#ffffff" />
<item android:state_checked="true" android:color="#ffffff" />
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:color="#ffffff" />
<item android:state_checked="true" android:color="#727272" />
</selector>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="false"
android:state_pressed="false"
android:color="#ffffff"/>
<item
android:state_checked="false"
android:state_pressed="true"
android:color="#ffffff"/>
<item
android:state_checked="true"
android:state_pressed="false"
android:color="#ff8f00"/>
<item
android:state_checked="true"
android:state_pressed="true"
android:color="#ff8f00"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#525e66" />
<corners
android:radius="3dp" />
</shape>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="#cccccc" />
<corners
android:radius="3dp" />
</shape>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<size
android:width="360dp"
android:height="144dp"/>
<solid android:color="#ff8f00"/>
</shape>
</item>
<item>
<bitmap android:src="@drawable/ic_extension_dark" android:gravity="center" />
</item>
</layer-list>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#4caf50" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#66bb6a" />
</shape>
</item>
</selector>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true"
android:drawable="@drawable/ic_action_settings_enabled_dark" />
<item android:state_enabled="false"
android:drawable="@drawable/ic_action_settings_disabled_dark" />
</selector>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true"
android:drawable="@drawable/ic_action_settings_enabled_light" />
<item android:state_enabled="false"
android:drawable="@drawable/ic_action_settings_disabled_light" />
</selector>

View file

@ -1,27 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ff8f00" />
<stroke android:width="1.5dp" android:color="#ff8f00" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ffb24c" />
<stroke android:width="1.5dp" android:color="#ffb24c" />
</shape>
</item>
<item android:state_checked="true" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@null" />
<stroke android:width="1.5dp" android:color="#ff8f00" />
<solid android:color="#ff8f00" />
</shape>
</item>
<item android:state_checked="true" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ffb24c" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@null" />
<stroke android:width="1.5dp" android:color="#77848c" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#66ff8f00" />

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ff8f00" />
</shape>
</item>
<item android:state_checked="true" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#ffb24c" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@null" />
<stroke android:width="1.5dp" android:color="#727272" />
</shape>
</item>
<item android:state_checked="false" android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="#66ff8f00" />
<stroke android:width="1.5dp" android:color="#ff8f00" />
</shape>
</item>
</selector>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/dash_plugin_item"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@ -17,12 +18,12 @@
android:layout_height="54dp"
android:orientation="horizontal">
<ImageView
<ImageButton
android:id="@+id/plugin_logo"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="11dp"
android:background="@drawable/bg_plugin_logo"
android:background="@drawable/bg_plugin_logo_enabled"
android:scaleType="center"
tools:src="@drawable/ic_extension_dark"/>
@ -41,29 +42,56 @@
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum"/>
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/check_item"
android:layout_width="wrap_content"
<FrameLayout
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:background="@drawable/switch_ex_background"
android:minHeight="0dp"
android:minWidth="0dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
osmand:textAllCapsCompat="true"
android:textColor="@color/switch_ex_text_color"
android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin"
android:textSize="12sp"
osmand:typeface="@string/font_roboto_medium"/>
android:layout_marginLeft="6dp"
android:layout_marginRight="16dp"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp">
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/switch_ex_background"
android:minHeight="0dp"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin"
android:textSize="12sp"
android:lines="1"
android:maxLines="1"
android:ellipsize="end"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/get_plugin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/get_button_background"
android:minHeight="0dp"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:textColor="@color/get_button_text"
android:text="@string/get_plugin"
android:textSize="12sp"
android:lines="1"
android:maxLines="1"
android:ellipsize="end"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>

View file

@ -35,7 +35,7 @@
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_settings_dark"
android:src="@drawable/ic_action_settings_enabled_dark"
android:focusable="false"
android:gravity="center_vertical" />

View file

@ -4,8 +4,7 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@ -14,57 +13,118 @@
tools:context=".activities.PluginActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="144dp"
android:visibility="gone"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="144dp"
android:maxWidth="360dp"
android:scaleType="centerInside"
android:layout_gravity="center_horizontal"
android:src="@drawable/extension_stub"/>
<FrameLayout
android:id="@+id/plugin_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp">
android:background="?attr/plugin_details_header_bg"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginBottom="9dp"
android:layout_marginTop="9dp"
android:layout_gravity="center_vertical|start"
android:textSize="12sp"
osmand:textAllCapsCompat="true"
android:textColor="?android:textColorPrimary"
android:background="@null"
android:drawableLeft="?attr/ic_action_settings"
android:drawableStart="?attr/ic_action_settings"
android:drawablePadding="10dp"
android:drawableStart="?attr/ic_action_settings"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:text="@string/plugin_settings_button_caption"
android:textColor="?android:textColorPrimary"
android:textSize="12sp"
android:lines="1"
android:maxLines="1"
android:ellipsize="end"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable"
android:layout_width="wrap_content"
<FrameLayout
android:layout_width="139dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/switch_ex_background"
android:minHeight="0dp"
android:minWidth="0dp"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
osmand:textAllCapsCompat="true"
android:textColor="@color/switch_ex_text_color"
android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin"
android:textSize="12sp"
osmand:typeface="@string/font_roboto_medium"/>
android:layout_marginTop="16dp">
<net.osmand.plus.widgets.SwitchEx
android:id="@+id/plugin_enable_disable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/switch_ex_background"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:textColor="?attr/switch_ex_text_color"
android:textOff="@string/enable_plugin"
android:textOn="@string/disable_plugin"
android:textSize="12sp"
android:lines="1"
android:maxLines="1"
android:ellipsize="end"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<net.osmand.plus.widgets.ButtonEx
android:id="@+id/plugin_get"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/get_button_background"
android:paddingBottom="8dp"
android:paddingLeft="9.5dp"
android:paddingRight="9.5dp"
android:paddingTop="8dp"
android:textColor="@color/get_button_text"
android:text="@string/get_plugin"
android:textSize="12sp"
android:visibility="gone"
android:lines="1"
android:maxLines="1"
android:ellipsize="end"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
</FrameLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/plugin_install_header"
android:layout_width="match_parent"
android:layout_height="66dp"
android:background="?attr/plugin_details_install_header_bg"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="?attr/ic_world_globe"/>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="?attr/plugin_description_header_text_color"
android:text="@string/plugin_install_needs_network"
osmand:typeface="@string/font_roboto_regular"/>
</LinearLayout>
<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -72,6 +132,8 @@
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:text="@string/plugin_description_title"
android:textSize="14sp"
android:textColor="?attr/plugin_description_header_text_color"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
@ -82,6 +144,8 @@
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="14dp"
android:textSize="16sp"
android:textColor="?android:textColorPrimary"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum"/>

View file

@ -10,7 +10,6 @@
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="6dp"
android:layout_weight="1"
android:divider="@null"
android:dividerHeight="4dp"

View file

@ -1,88 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="84dp"
android:background="?attr/card_bg"
android:descendantFocusability="blocksDescendants"
android:padding="2dp">
android:paddingLeft="6dp"
android:paddingRight="6dp">
<LinearLayout
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/plugin_logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_margin="8dp"
android:background="@drawable/bg_plugin_logo"
android:scaleType="center"
tools:src="@drawable/ic_extension_dark"/>
android:background="?attr/card_bg"
android:descendantFocusability="blocksDescendants"
android:padding="2dp">
<LinearLayout
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="horizontal">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="50dp"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="19sp"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/lorem_ipsum" />
<ImageButton
android:id="@+id/plugin_logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_margin="8dp"
android:background="@drawable/bg_plugin_logo_enabled"
android:scaleType="center"
tools:src="@drawable/ic_extension_dark"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="2"
android:maxLines="2"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginEnd="36dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="36dp"
android:layout_marginStart="6dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="19sp"
osmand:typeface="@string/font_roboto_medium"
tools:text="@string/lorem_ipsum"/>
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/plugin_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="2"
android:maxLines="2"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
osmand:typeface="@string/font_roboto_regular"
tools:text="@string/lorem_ipsum"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:orientation="horizontal">
<ImageView
android:id="@+id/plugin_is_enabled"
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:src="?attr/ic_action_check"
android:visibility="invisible"
tools:visibility="visible"/>
android:layout_height="match_parent"
android:layout_gravity="top|end">
<ImageButton
android:id="@+id/plugin_options"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?attr/ic_plugin_options"/>
</LinearLayout>
<ImageView
android:id="@+id/plugin_is_enabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:layout_marginTop="6dp"
android:src="?attr/ic_action_check"
android:visibility="invisible"
tools:visibility="visible"/>
<ImageButton
android:id="@+id/plugin_options"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="6dp"
android:background="?attr/ic_plugin_options"/>
</FrameLayout>
</FrameLayout>
</FrameLayout>

View file

@ -2015,4 +2015,8 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="plugin_settings_button_caption">Налады</string>
<string name="edit_group">Правіць групу</string>
<string name="osmo">OsMo</string>
</resources>
<string name="plugin_install_needs_network">Неабходна падключэньне да Інтэрнэту, каб усталяваць гэты модуль.</string>
<string name="enable_plugin2">Уключыць</string>
<string name="disable_plugin2">Адключыць</string>
<string name="get_plugin">Атрымаць</string>
</resources>

View file

@ -1889,4 +1889,5 @@
<string name="plugin_description_title">Descripció</string>
<string name="plugin_settings_button_caption">Configuració</string>
<string name="edit_group">Edició del grup</string>
</resources>
<string name="plugin_install_needs_network">Us cal una connexió a internet per instal·lar aquest connector.</string>
</resources>

View file

@ -1905,4 +1905,5 @@
<string name="plugin_description_title">Beskrivelse</string>
<string name="plugin_settings_button_caption">Indstillinger</string>
<string name="edit_group">Rediger gruppe</string>
</resources>
<string name="plugin_install_needs_network">Der behøves en internetforbindelse for at installere udvidelsen.</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="traffic_warning_speed_limit">Geschwindigkeitsbegrenzung</string>
<string name="traffic_warning_border_control">Grenzkontrolle</string>
@ -2040,7 +2040,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="osm_editing_manage">Verwalten</string>
<string name="recents">VERLAUF</string>
<string name="navigation_over_track">Navigation über Strecke starten?</string>
<string name="avoid_roads_msg">Sie können die Route ändern, indem Sie die Straßen auswählen, die vermieden werden sollen</string>
<string name="avoid_roads_msg">Durch Setzen einer Straßensperrung kann eine alternative Route berechnet werden:</string>
<string name="enable_proxy_title">HTTP-Proxy aktivieren</string>
<string name="enable_proxy_descr">HTTP-Proxy für alle Netzwerkanfragen einrichten</string>
<string name="proxy_host_title">Proxy-Host</string>
@ -2051,4 +2051,6 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="disable_plugin">Deaktivieren</string>
<string name="plugin_description_title">Beschreibung</string>
<string name="plugin_settings_button_caption">Einstellungen</string>
</resources>
<string name="plugin_install_needs_network">Die Installation dieses Plugins benötigt eine Internet-Verbindung.</string>
<string name="edit_group">Gruppe bearbeiten</string>
</resources>

View file

@ -548,8 +548,8 @@
<string name="search_nothing_found">No se encontró nada</string>
<string name="searching">Buscando…</string>
<string name="searching_address">Buscando dirección…</string>
<string name="search_osm_nominatim">Buscar dirección usando OSM Nominatim</string>
<string name="hint_search_online">Busqueda online: Número de casa, calle, ciudad</string>
<string name="search_osm_nominatim">Buscar en línea usando OSM Nominatim</string>
<string name="hint_search_online">Búsqueda en línea: Número de casa, calle, ciudad</string>
<string name="search_offline_address">Búsqueda sin conexión</string>
<string name="search_online_address">Búsqueda en línea</string>
<string name="max_level_download_tile">Máx. acercamiento con conexión</string>
@ -1914,4 +1914,5 @@
<string name="plugin_description_title">Descripción</string>
<string name="plugin_settings_button_caption">Opciones</string>
<string name="edit_group">Editar grupo</string>
</resources>
<string name="plugin_install_needs_network">Necesitas una conexión a Internet para instalar este plugin.</string>
</resources>

View file

@ -1923,4 +1923,5 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="plugin_description_title">Description</string>
<string name="plugin_settings_button_caption">Paramètres</string>
<string name="edit_group">Modifier le groupe</string>
</resources>
<string name="plugin_install_needs_network">Vous devez être connectés à Internet pour installer ce greffon.</string>
</resources>

View file

@ -2072,4 +2072,5 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="plugin_description_title">Descrizione</string>
<string name="plugin_settings_button_caption">Impostazioni</string>
<string name="edit_group">Modifica il gruppo</string>
</resources>
<string name="plugin_install_needs_network">È necessario la connessione a internet per installare questo componente aggiuntivo.</string>
</resources>

View file

@ -2135,4 +2135,5 @@
<string name="plugin_description_title">설명</string>
<string name="plugin_settings_button_caption">설정</string>
<string name="edit_group">그룹 편집</string>
</resources>
<string name="plugin_install_needs_network">이 플러그인을 설치 하려면 인터넷에 연결을 해야 합니다.</string>
</resources>

View file

@ -1764,7 +1764,7 @@
<string name="rendering_attr_coloredBuildings_name">Spalvoti pastatai</string>
<string name="rendering_attr_alpineHiking_name">Kalnų žygiai (SAC)</string>
<string name="rendering_attr_osmcTraces_name">Padengimas žygių simboliais</string>
<string name="hide_all_waypoints">Pašalinti visus</string>
<string name="hide_all_waypoints">Pašalinti vis</string>
<string name="av_camera_pic_size">Nuotraukos dydis</string>
<string name="av_camera_pic_size_descr">Pasirinkti vidinės kameros nuotraukos dydį</string>
<string name="announce_nearby_favorites">Pranešti apie artimiausias įsimintas vietas</string>
@ -1911,4 +1911,5 @@
<string name="plugin_description_title">Aprašymas</string>
<string name="plugin_settings_button_caption">Nustatymai</string>
<string name="edit_group">Redaguoti grupę</string>
</resources>
<string name="plugin_install_needs_network">Prisijunkite prie interneto, jei norite įdiegti šį priedą.</string>
</resources>

View file

@ -492,7 +492,7 @@
<string name="search_nothing_found">Ingenting funnet</string>
<string name="searching">Søker…</string>
<string name="searching_address">Søker adresse…</string>
<string name="hint_search_online">Husnummer, gate, by</string>
<string name="hint_search_online">Nettbasert søk: Husnummer, gate, by</string>
<string name="search_offline_address">Offline-søk</string>
<string name="search_online_address">Nettbasert søk</string>
<string name="max_level_download_tile">Maks. nettbasert zoom</string>
@ -1192,4 +1192,10 @@
<string name="speak_pedestrian">Meld om fotgjengeroverganger</string>
<string name="rendering_value__name">Standard</string>
<string name="rendering_attr_streetLighting_name">Gatebelysning</string>
<string name="edit_group">Rediger gruppe</string>
<string name="parking_place">Parkeringsplass</string>
<string name="points">Punkter</string>
<string name="tracks">Spor</string>
<string name="my_location">Min posisjon</string>
<string name="gps_status">GPS-status</string>
</resources>

View file

@ -2072,4 +2072,5 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="plugin_description_title">Omschrijving</string>
<string name="plugin_settings_button_caption">Instellingen</string>
<string name="edit_group">Bewerk groep</string>
</resources>
<string name="plugin_install_needs_network">Om deze plugin te installeren is een internetverbinding nodig.</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="amenity_type_administrative">Administrativo</string>
<string name="amenity_type_barrier">Barreira</string>
<string name="amenity_type_education">Educação</string>
@ -1824,4 +1824,58 @@ Afeganistão , Albânia, Argélia , Andorra, Angola , Anguilla, Antígua e Barbu
<string name="int_hour">h</string>
<string name="duration">Duração</string>
<string name="distance">Distância</string>
</resources>
<string name="gps_status">Status do GPS</string>
<string name="proxy_pref_title">Proxy</string>
<string name="settings_privacy">Privacidade</string>
<string name="points">Pontos</string>
<string name="my_location">Meus locais</string>
<string name="recents">RECENTES</string>
<string name="avoid_roads_msg">Você pode inciar rotas alternativas selecionando estradas a serem evitadas</string>
<string name="rendering_value__name">Padrão</string>
<string name="speak_pedestrian">Anunciar faixas de pedestre</string>
<string name="rendering_attr_roadStyle_name">Estilo de estrada</string>
<string name="rendering_value_default_name">Padrão</string>
<string name="rendering_value_orange_name">Laranja</string>
<string name="rendering_value_germanRoadAtlas_name">Atlas de rodovias alemãs</string>
<string name="traffic_warning_railways">Cruzamento de ferrovia</string>
<string name="traffic_warning_pedestrian">Cruzamento de faixa de pedestre</string>
<string name="show_railway_warnings">Exibir cruzamento de ferrovia</string>
<string name="show_pedestrian_warnings">Exibir faixas de pedestre</string>
<string name="rendering_value_americanRoadAtlas_name">Atlas de rodovias americanas</string>
<string name="routing_attr_no_new_routing_name">Regras de roteamento No v1.9</string>
<string name="remove_the_tag">REMOVA A TAG</string>
<string name="routing_attr_no_new_routing_description">Não use as regras de roteamento introduzidas na versão 1.9</string>
<string name="dash_download_msg_none">Deseja baixar mapas offline?</string>
<string name="dash_download_msg">Você baixou %1$s mapas</string>
<string name="dash_download_new_one">Baixe um novo mapa</string>
<string name="map_locale">Idioma do mapa</string>
<string name="navigate_point_zone">Zona</string>
<string name="download_tab_downloads">Todos os Downloads</string>
<string name="download_tab_updates">Atualizações</string>
<string name="download_tab_local">Local</string>
<string name="no_internet_connection">Download não é possível, por favor, verifique sua conexão com a internet.</string>
<string name="everything_up_to_date">Todos os arquivos foram atualizados</string>
<string name="use_opengl_render">Use o renderizador OpenGL</string>
<string name="home_button">Inicio</string>
<string name="osmo_use_https">Use HTTPS</string>
<string name="advanced_settings">Avançado</string>
<string name="map_update">Atualizações disponives para %1$s mapas</string>
<string name="search_for">Procurar por</string>
<string name="show_map">EXIBIR MAPA</string>
<string name="show_all">EXIBIR TODOS</string>
<string name="coordinates">Coordenadas</string>
<string name="rendering_attr_subwayMode_name">Rodas de metrô</string>
<string name="lock_screen_request_explanation">%1$s precisa dessa permissão para desligar a tela para economizar energia.</string>
<string name="wake_on_voice_never">Nunca</string>
<string name="select_impassable_road">Selecione o mapa…</string>
<string name="impassable_road">Evitar estradas…</string>
<string name="rendering_attr_trainLightrailRoutes_name">Rota de trem</string>
<string name="rendering_attr_tramRoutes_name">Rota de bonde</string>
<string name="rendering_attr_shareTaxiRoutes_name">Compartilhar rota de taxi</string>
<string name="rendering_attr_busRoutes_name">Rotas de onibus</string>
<string name="rendering_category_hide">Esconder</string>
<string name="rendering_category_routes">Rotas</string>
<string name="rendering_category_details">Detalhes</string>
<string name="map_widget_appearance_rem">Elementos restantes</string>
<string name="plugin_install_needs_network">Você precisa de uma conexão com a internet para instalar este plugin.</string>
</resources>

View file

@ -1872,10 +1872,14 @@
<string name="points">Точки</string>
<string name="parking_place">Место для парковки</string>
<string name="remove_the_tag">УДАЛИТЬ ТЕГ</string>
<string name="enable_plugin">Включить</string>
<string name="disable_plugin">Отключить</string>
<string name="enable_plugin">Выключено</string>
<string name="disable_plugin">Включено</string>
<string name="osm_editing_manage">Управление</string>
<string name="plugin_description_title">Описание</string>
<string name="plugin_settings_button_caption">Настройки</string>
<string name="edit_group">Редактировать группу</string>
</resources>
<string name="plugin_install_needs_network">Вам необходимо интернет соединение для установки этого плагина.</string>
<string name="enable_plugin2">Включить</string>
<string name="disable_plugin2">Выключить</string>
<string name="get_plugin">Получить</string>
</resources>

View file

@ -2056,4 +2056,5 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
<string name="edit_group">Upraviť skupinu</string>
<string name="plugin_description_title">Popis</string>
<string name="plugin_settings_button_caption">Nastavenia</string>
<string name="plugin_install_needs_network">Pre nainštalovanie tohto doplnku potrebujete pripojenie na Internet.</string>
</resources>

View file

@ -1737,7 +1737,7 @@
<string name="coordinates">Koordinater</string>
<string name="map_update">Det finns %1$s uppdatering(ar)</string>
<string name="error_avoid_specific_road">Hittar ingen förbifart</string>
<string name="dismiss">Avvisa</string>
<string name="dismiss">Avböj</string>
<string name="everything_up_to_date">Alla filer är uppdaterade</string>
<string name="use_opengl_render">Använd OpenGL-rendering</string>
<string name="use_opengl_render_descr">Använd hårdvaruaccelererad OpenGL-rendering (fungerar kanske inte på vissa enheter)</string>
@ -1797,4 +1797,5 @@
<string name="plugin_settings_button_caption">Inställningar</string>
<string name="plugin_description_title">Beskrivning</string>
<string name="edit_group">Redigera grupp</string>
</resources>
<string name="plugin_install_needs_network">En Internetuppkoppling krävs för att installera denna modul.</string>
</resources>

View file

@ -23,6 +23,13 @@
<attr name="ic_action_marker2" format="reference" />
<attr name="search_background" format="reference" />
<attr name="ic_action_settings" format="reference" />
<attr name="switch_ex_background" format="reference" />
<attr name="switch_ex_text_color" format="color|reference" />
<attr name="bg_plugin_logo_disabled" format="reference" />
<attr name="plugin_details_header_bg" format="color|reference" />
<attr name="plugin_details_install_header_bg" format="color|reference" />
<attr name="ic_world_globe" format="reference" />
<attr name="plugin_description_header_text_color" format="color|reference" />
</declare-styleable>
<declare-styleable name="PagerSlidingTabStrip">

View file

@ -101,4 +101,12 @@
<color name="card_bg_color_light">#ffffff</color>
<color name="card_bg_color_dark">#333b40</color>
<color name="get_button_text">#ffffff</color>
<color name="plugin_details_header_bg_light">#ffffff</color>
<color name="plugin_details_header_bg_dark">#333b40</color>
<color name="plugin_details_install_header_bg_light">#dbdbdb</color>
<color name="plugin_details_install_header_bg_dark">#2d3438</color>
</resources>

View file

@ -2085,8 +2085,12 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="av_camera_pic_size_descr">Select internal camera Picture Size</string>
<string name="navigation_intent_invalid">Invalid format: %s</string>
<string name="hide_all_waypoints">Remove all</string>
<string name="enable_plugin">Enable</string>
<string name="disable_plugin">Disable</string>
<string name="enable_plugin">Disabled</string>
<string name="disable_plugin">Enabled</string>
<string name="enable_plugin2">Enable</string>
<string name="disable_plugin2">Disable</string>
<string name="plugin_description_title">Description</string>
<string name="plugin_settings_button_caption">Settings</string>
<string name="plugin_install_needs_network">You need an Internet connection to install this plugin.</string>
<string name="get_plugin">Get</string>
</resources>

View file

@ -158,6 +158,13 @@
<item name="actionModeStyle">@style/WhiteActionMode</item>
<item name="android:actionMenuTextColor">@color/color_white</item>
<item name="actionMenuTextColor">@color/color_white</item>
<item name="switch_ex_background">@drawable/switch_ex_background_light</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_light</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_light</item>
<item name="plugin_details_header_bg">@color/plugin_details_header_bg_light</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_light</item>
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
<item name="plugin_description_header_text_color">#727272</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
@ -188,6 +195,13 @@
<item name="ic_action_marker2">@drawable/ic_action_marker2_dark</item>
<item name="search_background">@color/color_white</item>
<item name="ic_action_settings">@drawable/ic_action_settings_dark</item>
<item name="switch_ex_background">@drawable/switch_ex_background_dark</item>
<item name="switch_ex_text_color">@color/switch_ex_button_text_dark</item>
<item name="bg_plugin_logo_disabled">@drawable/bg_plugin_logo_disabled_dark</item>
<item name="plugin_details_header_bg">@color/plugin_details_header_bg_dark</item>
<item name="plugin_details_install_header_bg">@color/plugin_details_install_header_bg_dark</item>
<item name="ic_world_globe">@drawable/ic_world_globe_dark</item>
<item name="plugin_description_header_text_color">#70818c</item>
</style>
<style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">

View file

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.text.format.DateFormat;
import android.view.View;
import android.view.ViewParent;
import android.view.inputmethod.InputMethodManager;
public class AndroidUtils {
@ -49,4 +50,18 @@ public class AndroidUtils {
public static String formatTime(Context ctx, long time) {
return DateFormat.getTimeFormat(ctx).format(new Date(time));
}
public static View findParentViewById(View view, int id) {
ViewParent viewParent = view.getParent();
while (viewParent != null && viewParent instanceof View) {
View parentView = (View)viewParent;
if (parentView.getId() == id)
return parentView;
viewParent = parentView.getParent();
}
return null;
}
}

View file

@ -73,13 +73,17 @@ public abstract class OsmandPlugin {
return active;
}
public boolean couldBeActivated() {
public boolean needsInstallation() {
return installURL != null;
}
public void setInstallURL(String installURL) {
this.installURL = installURL;
}
public String getInstallURL() {
return installURL;
}
public void disable(OsmandApplication app) {};
@ -208,7 +212,7 @@ public abstract class OsmandPlugin {
return allPlugins;
}
public static Iterable<OsmandPlugin> getEnabledPlugins(){
public static List<OsmandPlugin> getEnabledPlugins(){
ArrayList<OsmandPlugin> lst = new ArrayList<OsmandPlugin>(allPlugins.size());
for(OsmandPlugin p : allPlugins) {
if(p.isActive()) {
@ -217,6 +221,16 @@ public abstract class OsmandPlugin {
}
return lst;
}
public static List<OsmandPlugin> getNotEnabledPlugins(){
ArrayList<OsmandPlugin> lst = new ArrayList<OsmandPlugin>(allPlugins.size());
for(OsmandPlugin p : allPlugins) {
if(!p.isActive()) {
lst.add(p);
}
}
return lst;
}
@SuppressWarnings("unchecked")
public static <T extends OsmandPlugin> T getEnabledPlugin(Class<T> clz) {

View file

@ -29,7 +29,6 @@ import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
@ -739,8 +738,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
final ImageView ch = (ImageView) row.findViewById(R.id.check_item);
ch.setVisibility(View.VISIBLE);
ch.setImageDrawable(getActivity().getResources().getDrawable(
getMyApplication().getSettings().isLightContent() ? R.drawable.ic_action_settings_light
: R.drawable.ic_action_settings_dark));
getMyApplication().getSettings().isLightContent() ? R.drawable.ic_action_settings_enabled_light
: R.drawable.ic_action_settings_enabled_dark));
ch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -31,10 +31,8 @@ import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.Version;
import net.osmand.plus.activities.actions.OsmAndDialogs;
import net.osmand.plus.activities.actions.ShareLocation;
import net.osmand.plus.activities.actions.StartGPSStatus;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.ConfigureMapMenu;
@ -889,7 +887,7 @@ public class MapActivityActions implements DialogProvider {
}).reg();
optionsMenuHelper.item(R.string.settings_activity)
.icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
.icons(R.drawable.ic_action_settings_enabled_dark, R.drawable.ic_action_settings_enabled_light)
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {

View file

@ -2,6 +2,7 @@ package net.osmand.plus.activities;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
@ -58,46 +59,48 @@ public class PluginActivity extends OsmandActionBarActivity {
TextView descriptionView = (TextView)findViewById(R.id.plugin_description);
descriptionView.setText(plugin.getDescription());
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
final Button settingsButton = (Button)findViewById(R.id.plugin_settings);
if (settingsActivity == null) {
settingsButton.setVisibility(View.GONE);
} else {
settingsButton.setEnabled(plugin.isActive());
settingsButton.setVisibility(View.VISIBLE);
settingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(PluginActivity.this, settingsActivity));
}
});
}
Button settingsButton = (Button)findViewById(R.id.plugin_settings);
settingsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(PluginActivity.this, plugin.getSettingsActivity()));
}
});
CompoundButton enableDisableButton = (CompoundButton)findViewById(
R.id.plugin_enable_disable);
enableDisableButton.setChecked(plugin.isActive());
enableDisableButton.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (plugin.isActive() == isChecked) {
return;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (plugin.isActive() == isChecked) {
return;
}
boolean ok = OsmandPlugin.enablePlugin((OsmandApplication)getApplication(), plugin,
isChecked);
settingsButton.setEnabled(isChecked && ok);
boolean ok = OsmandPlugin.enablePlugin((OsmandApplication)getApplication(),
plugin, isChecked);
if (!ok) {
return;
}
updateState();
}
});
Button getButton = (Button)findViewById(R.id.plugin_get);
getButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
});
updateState();
}
@Override
protected void onResume() {
super.onResume();
CompoundButton enableDisableButton = (CompoundButton)findViewById(
R.id.plugin_enable_disable);
enableDisableButton.setChecked(plugin.isActive());
updateState();
}
@Override
@ -111,4 +114,33 @@ public class PluginActivity extends OsmandActionBarActivity {
}
return false;
}
private void updateState() {
CompoundButton enableDisableButton = (CompoundButton)findViewById(
R.id.plugin_enable_disable);
Button getButton = (Button)findViewById(R.id.plugin_get);
Button settingsButton = (Button)findViewById(R.id.plugin_settings);
View installHeader = findViewById(R.id.plugin_install_header);
if (plugin.needsInstallation()) {
getButton.setVisibility(View.VISIBLE);
enableDisableButton.setVisibility(View.GONE);
settingsButton.setVisibility(View.GONE);
installHeader.setVisibility(View.VISIBLE);
} else {
getButton.setVisibility(View.GONE);
enableDisableButton.setVisibility(View.VISIBLE);
enableDisableButton.setChecked(plugin.isActive());
final Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
if (settingsActivity == null) {
settingsButton.setVisibility(View.GONE);
} else {
settingsButton.setEnabled(plugin.isActive());
settingsButton.setVisibility(View.VISIBLE);
}
installHeader.setVisibility(View.GONE);
}
}
}

View file

@ -6,6 +6,7 @@ import net.osmand.plus.R;
import android.app.Activity;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v7.widget.PopupMenu;
import android.view.MenuItem;
@ -13,7 +14,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ImageButton;
import android.widget.TextView;
public class PluginsActivity extends OsmandListActivity {
@ -80,8 +81,22 @@ public class PluginsActivity extends OsmandListActivity {
view.setTag(plugin);
ImageView pluginLogo = (ImageView)view.findViewById(R.id.plugin_logo);
ImageButton pluginLogo = (ImageButton)view.findViewById(R.id.plugin_logo);
pluginLogo.setImageResource(plugin.getLogoResourceId());
if (plugin.isActive()) {
pluginLogo.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
} else {
TypedArray attributes = getTheme().obtainStyledAttributes(
new int[] {R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
enableDisablePlugin(plugin, !plugin.isActive());
}
});
TextView pluginName = (TextView)view.findViewById(R.id.plugin_name);
pluginName.setText(plugin.getName());
@ -113,8 +128,8 @@ public class PluginsActivity extends OsmandListActivity {
final PopupMenu optionsMenu = new PopupMenu(this, v);
MenuItem enableDisableItem = optionsMenu.getMenu().add(plugin.isActive()
? R.string.disable_plugin
: R.string.enable_plugin);
? R.string.disable_plugin2
: R.string.enable_plugin2);
enableDisableItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {

View file

@ -533,8 +533,8 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
} else if(model.getType() == GpxDisplayItemType.TRACK_SEGMENT) {
ch.setVisibility(View.VISIBLE);
ch.setImageDrawable(getMyActivity().getResources().getDrawable(
app.getSettings().isLightContent() ? R.drawable.ic_action_settings_light
: R.drawable.ic_action_settings_dark));
app.getSettings().isLightContent() ? R.drawable.ic_action_settings_enabled_light
: R.drawable.ic_action_settings_enabled_dark));
ch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -1,20 +1,26 @@
package net.osmand.plus.dashboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import android.app.Activity;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -26,21 +32,34 @@ public class DashPluginsFragment extends DashBaseFragment {
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
OsmandPlugin plugin = (OsmandPlugin)buttonView.getTag();
if (plugin.isActive() == isChecked) {
View pluginView = AndroidUtils.findParentViewById(buttonView, R.id.dash_plugin_item);
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
if (plugin.isActive() == isChecked || plugin.needsInstallation()) {
return;
}
OsmandPlugin.enablePlugin(getMyApplication(), plugin, isChecked);
if (OsmandPlugin.enablePlugin(getMyApplication(), plugin, isChecked)) {
updatePluginState(pluginView);
}
}
};
private final View.OnClickListener pluginSettingsListener = new View.OnClickListener() {
private final View.OnClickListener toggleEnableDisableListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
OsmandPlugin plugin = (OsmandPlugin)view.getTag();
View pluginView = AndroidUtils.findParentViewById(view, R.id.dash_plugin_item);
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
if (OsmandPlugin.enablePlugin(getMyApplication(), plugin, !plugin.isActive())) {
updatePluginState(pluginView);
}
}
};
Class<? extends Activity> settingsActivity = plugin.getSettingsActivity();
startActivity(new Intent(getActivity(), settingsActivity));
private final View.OnClickListener getListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
View pluginView = AndroidUtils.findParentViewById(view, R.id.dash_plugin_item);
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL())));
}
};
@ -68,22 +87,21 @@ public class DashPluginsFragment extends DashBaseFragment {
});
LinearLayout pluginsContainer = (LinearLayout) contentView.findViewById(R.id.plugins);
List<OsmandPlugin> enabledPlugins = OsmandPlugin.getAvailablePlugins();
for(OsmandPlugin plugin : enabledPlugins) {
if (plugin instanceof OsmandDevelopmentPlugin) {
List<OsmandPlugin> notActivePlugins = OsmandPlugin.getNotEnabledPlugins();
Collections.shuffle(notActivePlugins);
for(OsmandPlugin plugin : notActivePlugins) {
if (plugin instanceof OsmandDevelopmentPlugin) {
continue;
}
inflatePluginView(inflater, pluginsContainer, plugin);
break;
}
for(OsmandPlugin plugin : OsmandPlugin.getAvailablePlugins()) {
if (pluginsContainer.getChildCount() > 2) {
for(OsmandPlugin plugin : OsmandPlugin.getEnabledPlugins()) {
if (pluginsContainer.getChildCount() >= 5) {
break;
}
if (plugin instanceof OsmandDevelopmentPlugin) {
continue;
}
if (enabledPlugins.contains(plugin)) {
if (plugin instanceof OsmandDevelopmentPlugin) {
continue;
}
@ -105,41 +123,59 @@ public class DashPluginsFragment extends DashBaseFragment {
for (int pluginIndex = 0; pluginIndex < pluginsContainer.getChildCount(); pluginIndex++) {
View pluginView = pluginsContainer.getChildAt(pluginIndex);
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
boolean isEnabled = plugin.isActive();
CompoundButton enableDisableButton = (CompoundButton) pluginView.findViewById(
R.id.check_item);
enableDisableButton.setChecked(isEnabled);
updatePluginState(pluginView);
}
}
private void updatePluginState(View pluginView) {
OsmandPlugin plugin = (OsmandPlugin)pluginView.getTag();
CompoundButton enableDisableButton = (CompoundButton)pluginView.findViewById(
R.id.plugin_enable_disable);
Button getButton = (Button)pluginView.findViewById(R.id.get_plugin);
if (plugin.needsInstallation()) {
getButton.setVisibility(View.VISIBLE);
enableDisableButton.setVisibility(View.GONE);
} else {
getButton.setVisibility(View.GONE);
enableDisableButton.setVisibility(View.VISIBLE);
enableDisableButton.setChecked(plugin.isActive());
}
ImageButton logoView = (ImageButton)pluginView.findViewById(R.id.plugin_logo);
if (plugin.isActive()) {
logoView.setBackgroundResource(R.drawable.bg_plugin_logo_enabled);
} else {
TypedArray attributes = getActivity().getTheme().obtainStyledAttributes(
new int[] {R.attr.bg_plugin_logo_disabled});
logoView.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}
}
private void inflatePluginView(LayoutInflater inflater, ViewGroup container,
OsmandPlugin plugin) {
View view = inflater.inflate(R.layout.dash_plugin_item, container, false);
view.setTag(plugin);
// To discuss: too much confusing and not consistent
// boolean hasSettings = (plugin.getSettingsActivity() != null);
// if (isEnabled && hasSettings) {
// view.setOnClickListener(pluginSettingsListener);
// } else {
// view.setOnClickListener(pluginDetailsListener);
// }
view.setOnClickListener(pluginDetailsListener);
TextView nameView = (TextView)view.findViewById(R.id.plugin_name);
nameView.setText(plugin.getName());
ImageView logoView = (ImageView)view.findViewById(R.id.plugin_logo);
ImageButton logoView = (ImageButton)view.findViewById(R.id.plugin_logo);
logoView.setOnClickListener(toggleEnableDisableListener);
logoView.setImageResource(plugin.getLogoResourceId());
CompoundButton enableDisableButton = (CompoundButton)view.findViewById(R.id.check_item);
enableDisableButton.setTag(plugin);
enableDisableButton.setChecked(plugin.isActive());
CompoundButton enableDisableButton =
(CompoundButton)view.findViewById(R.id.plugin_enable_disable);
enableDisableButton.setOnCheckedChangeListener(enableDisableListener);
Button getButton = (Button)view.findViewById(R.id.get_plugin);
getButton.setOnClickListener(getListener);
updatePluginState(view);
container.addView(view);
}
}

View file

@ -29,7 +29,6 @@ import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.preference.PreferenceGroup;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Toast;
@ -65,7 +64,7 @@ public class ConfigureMapMenu {
createLayersItems(adapter, ma);
if (!advanced){
adapter.item(R.string.btn_advanced_mode).icons(R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_light)
adapter.item(R.string.btn_advanced_mode).icons(R.drawable.ic_action_settings_enabled_dark, R.drawable.ic_action_settings_enabled_light)
.selected(advanced ? 1 : 0)
.listen(new OnContextMenuClick() {
@Override

View file

@ -438,7 +438,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
device != null && device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
///
if (device != null) {
createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark,
createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_enabled_light, R.drawable.ic_action_settings_enabled_dark,
// there is a bug in Android 4.2 layout
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
}
@ -963,7 +963,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
R.drawable.ic_action_plus_dark, R.drawable.ic_action_plus_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
createMenuItem(menu, SETTINGS_ID, R.string.settings,
R.drawable.ic_action_settings_dark, R.drawable.ic_action_settings_dark,
R.drawable.ic_action_settings_enabled_dark, R.drawable.ic_action_settings_enabled_dark,
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
return super.onCreateOptionsMenu(menu);
}
@ -1162,9 +1162,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
v.setVisibility(View.GONE);
} else {
if (getMyApplication().getSettings().isLightContent()){
v.setImageResource(R.drawable.ic_action_settings_light);
v.setImageResource(R.drawable.ic_action_settings_enabled_light);
} else {
v.setImageResource(R.drawable.ic_action_settings_dark);
v.setImageResource(R.drawable.ic_action_settings_enabled_dark);
}
v.setVisibility(View.VISIBLE);
v.setOnClickListener(new View.OnClickListener() {