Merge pull request #1072 from Bars107/master

Styles for list view, popup menus and downloads.
This commit is contained in:
vshcherb 2015-02-13 14:39:38 +01:00
commit 1b1fe77f53
51 changed files with 801 additions and 508 deletions

View file

@ -0,0 +1,30 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#475259"
android:centerColor="#475259"
android:centerY="1.0"
android:endColor="#475259"
android:angle="270"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="@color/color_distance"
android:centerColor="@color/color_distance"
android:centerY="1.0"
android:endColor="@color/color_distance"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>

View file

@ -0,0 +1,30 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Define the background properties like color etc -->
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#475259"
android:centerColor="#475259"
android:centerY="1.0"
android:endColor="#475259"
android:angle="270"
/>
</shape>
</item>
<!-- Define the progress properties like start color, end color etc -->
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="@color/color_distance"
android:centerColor="@color/color_distance"
android:centerY="1.0"
android:endColor="@color/color_distance"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>

View file

@ -74,7 +74,7 @@
android:orientation="horizontal">
<ProgressBar
android:id="@+id/DeterminateProgressBar"
android:id="@+id/memory_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -98,7 +98,7 @@
<Button
android:id="@+id/DownloadButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/bottom_tool_bar_size"
android:background="?attr/downloadButtonBackground"
android:gravity="center"
android:text="@string/download_files"

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="?attr/expandable_list_item_background"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:paddingBottom="1dp"
android:paddingLeft="@dimen/list_content_padding"
@ -14,25 +14,49 @@
android:id="@+id/check_download_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/download_item"
style="@style/ListText.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
tools:text="@string/lorem_ipsum"
android:maxLines="7"/>
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:focusable="false"/>
<TextView
android:id="@+id/download_descr"
style="@style/ListText.Small"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:gravity="right"/>
android:orientation="vertical">
<TextView
android:id="@+id/name"
style="@style/ListText.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/download_descr"
style="@style/ListText.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:textSize="12sp"
tools:text="@string/lorem_ipsum"/>
<TextView
android:id="@+id/update_descr"
style="@style/ListText.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_distance"
android:textSize="12sp"
tools:text="@string/lorem_ipsum"
android:maxLines="1"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -5,7 +5,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/DescriptionText"
android:id="@+id/memory_size"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
@ -18,8 +18,10 @@
<ExpandableListView
android:id="@android:id/list"
style="@style/OsmandListView"
android:divider="@drawable/divider"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_height="0dp"
android:background="?attr/expandable_list_background"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginTop="0dp"

View file

@ -1,43 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_category_color"
android:paddingBottom="5dp"
android:paddingLeft="@dimen/list_header_padding"
android:paddingRight="@dimen/list_header_padding"
android:paddingTop="5dp">
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:paddingLeft="@dimen/list_header_padding">
<ImageView
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/expandable_category_unpushed" />
<ImageView
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_top_margin"
android:src="@drawable/expandable_category_unpushed"/>
<TextView
android:id="@+id/category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="0dp"
android:autoLink="web"
android:gravity="center_vertical"
android:textSize="18sp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right">
<CheckBox
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_header_text_left_margin"
android:layout_marginTop="@dimen/list_header_top_margin"
android:maxLines="1"
android:textSize="@dimen/list_header_text_size"
tools:text="@string/lorem_ipsum"/>
<CheckBox
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_settings_top_margin"
android:focusable="false"
android:visibility="gone"/>
</LinearLayout>

View file

@ -1,45 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_category_color"
android:paddingBottom="5dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:paddingTop="5dp">
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_header_height"
android:paddingLeft="@dimen/list_header_padding">
<ImageView
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="6dp"
android:src="@drawable/expandable_category_unpushed" />
<TextView
android:id="@+id/category_name"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="0dp"
android:gravity="center_vertical"
android:textSize="18sp"></TextView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
<ImageView
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_settings_enabled_dark"
android:focusable="false"
android:gravity="center_vertical" />
</LinearLayout>
<ImageView
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_top_margin"
android:src="@drawable/expandable_category_unpushed"/>
<TextView
android:id="@+id/category_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/list_header_bottom_margin"
android:layout_marginLeft="@dimen/list_header_text_left_margin"
android:layout_marginTop="@dimen/list_header_top_margin"
android:layout_weight="1"
android:maxLines="1"
android:textSize="@dimen/list_header_text_size"
tools:text="@string/lorem_ipsum"/>
<ImageView
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_settings_top_margin"
android:focusable="false"
android:src="?attr/list_settings_icon"/>
</LinearLayout>

View file

@ -1,57 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:stretchColumns="1">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favourites_edit_dialog_name" />
<EditText
android:id="@+id/Name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="3dp"
android:selectAllOnFocus="true" />
</TableRow>
<TableRow>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/dialog_content_bottom_margin"
android:paddingLeft="@dimen/dialog_content_margin"
android:paddingRight="@dimen/dialog_content_margin"
android:paddingTop="@dimen/dialog_content_bottom_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/osmo_group_description" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dialog_elements_vertical_margin"
android:text="@string/favourites_edit_dialog_name"/>
<EditText
android:id="@+id/descr"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:inputType="textCapWords"
android:paddingLeft="3dp"
android:selectAllOnFocus="true" />
</TableRow>
android:id="@+id/Name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:selectAllOnFocus="true"/>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favourites_edit_dialog_category" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dialog_elements_vertical_margin"
android:text="@string/favourites_edit_dialog_category"/>
<AutoCompleteTextView
android:id="@+id/Category"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:inputType="textCapWords"
android:paddingLeft="3dp"
android:selectAllOnFocus="true" />
</TableRow>
</TableLayout>
<AutoCompleteTextView
android:id="@+id/Category"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:inputType="textCapWords"
android:selectAllOnFocus="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dialog_elements_vertical_margin"
android:text="@string/osmo_group_description"/>
<EditText
android:id="@+id/descr"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:completionThreshold="1"
android:inputType="textCapWords"
android:selectAllOnFocus="true"/>
</LinearLayout>
</LinearLayout>

View file

@ -3,40 +3,92 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="?attr/expandable_list_item_background"
android:minHeight="@dimen/list_item_height"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding"
android:background="?attr/expandable_list_item_background"
android:paddingTop="5dp">
android:paddingRight="@dimen/list_content_padding">
<CheckBox
android:id="@+id/check_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:focusable="false"
android:gravity="center_vertical"
android:visibility="gone"/>
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/favourite_icon"
android:layout_width="25dp"
android:layout_height="fill_parent"
android:paddingRight="2dp"
android:paddingTop="2dp"/>
<ImageView
android:id="@+id/favourite_icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/favorites_icon_right_margin"/>
<TextView
android:id="@+id/favourite_label"
style="@style/ListText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
tools:text="@string/lorem_ipsum"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/favourite_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/dashFavNameTextSize"
tools:text="@string/lorem_ipsum"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/direction"
android:layout_width="@dimen/dashFavDirectionSize"
android:layout_height="@dimen/dashFavDirectionSize"
android:layout_gravity="center_vertical"
android:visibility="gone"/>
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/showAllButtonTextSize"
tools:text="100500 km"/>
<ImageView
android:id="@+id/group_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:src="@drawable/ic_small_group"/>
<TextView
android:id="@+id/group_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="4dp"
android:textColor="@color/dashboard_descr_colol"
android:textSize="@dimen/showAllButtonTextSize"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,25 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/DescriptionText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="10dp"
android:text="@string/download_link_and_local_description" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/dialog_content_bottom_margin"
android:paddingRight="@dimen/dialog_content_bottom_margin"
android:layout_marginBottom="@dimen/dialog_content_bottom_margin"
android:paddingTop="10dp">
<ExpandableListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:groupIndicator="@android:color/transparent"
style="@style/OsmandListView"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/local_size_height"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="@string/device_memory"/>
<TextView
android:id="@+id/memory_size"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/free"/>
</LinearLayout>
<ProgressBar
android:id="@+id/memory_progress"
style="?android:attr/progressBarStyleHorizontal"
android:progressDrawable="?attr/size_progress_bar"
android:layout_width="fill_parent"
android:layout_height="20dp" />
</LinearLayout>
<ExpandableListView
android:id="@android:id/list"
style="@style/OsmandListView"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:groupIndicator="@android:color/transparent"/>
</LinearLayout>

View 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"
android:layout_width="match_parent"
android:layout_height="@dimen/list_header_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/list_header_padding"
android:paddingRight="@dimen/list_header_padding">
<TextView
android:id="@+id/category_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="@dimen/list_header_top_margin"
android:maxLines="1"
android:textSize="@dimen/list_header_text_size"
tools:text="@string/app_version"/>
<TextView
android:id="@+id/category_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/list_header_top_margin"
android:maxLines="1"
android:textSize="@dimen/list_header_text_size"
tools:text="@string/app_version"/>
</LinearLayout>

View file

@ -46,6 +46,7 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="?attr/expandable_list_background"
android:divider="@drawable/divider"
android:dividerHeight="1dp" />

View file

@ -5,7 +5,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/DescriptionText"
android:id="@+id/memory_size"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"

View file

@ -16,5 +16,5 @@
android:orientation="horizontal"
android:id="@+id/bottomControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="@dimen/bottom_tool_bar_size"/>
</LinearLayout>

View file

@ -7,7 +7,8 @@
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
style="@style/OsmandListView"/>
<Button

View file

@ -42,6 +42,6 @@
android:background="?attr/bottomToolBarColor"
android:id="@+id/bottomControls"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="@dimen/bottom_tool_bar_size"/>
</LinearLayout>

View file

@ -1,45 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height"
android:paddingBottom="5dp"
android:paddingTop="5dp">
android:orientation="horizontal"
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
<ImageView
android:id="@+id/poi_icon"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginRight="@dimen/favorites_icon_right_margin"
tools:visiblity="visible"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:paddingLeft="6dp"
android:paddingRight="3dp">
android:orientation="vertical"
android:paddingRight="3dp">
<ImageView
android:id="@+id/poi_direction"
android:layout_width="26dp"
android:layout_height="26dp" />
<TextView
android:id="@+id/poi_label"
style="@style/ListText.Small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
<ImageView
android:id="@+id/poi_icon"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginLeft="3dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
<ImageView
android:id="@+id/poi_direction"
android:layout_width="@dimen/dashFavDirectionSize"
android:layout_height="@dimen/dashFavDirectionSize"
android:layout_gravity="center_vertical"
tools:visiblity="visible"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:paddingRight="3dp">
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_distance"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
<TextView
android:id="@+id/poi_label"
style="@style/ListText.Small"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -22,7 +22,7 @@
android:text="@string/gpx_description_txt" />
<EditText
android:id="@+id/DescriptionText"
android:id="@+id/memory_size"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"

View file

@ -20,6 +20,6 @@
android:id="@+id/bottomControls"
android:background="?attr/bottomToolBarColor"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:layout_height="@dimen/bottom_tool_bar_size"/>
</LinearLayout>

View file

@ -4,6 +4,7 @@
<attr name="maxVisibleWidth" format="dimension"/>
</declare-styleable>
<declare-styleable name="OsmAndTheme">
<attr name="list_divider" format="color"/>
<attr name="expandable_category_color" format="reference"/>
<attr name="reset_image" format="reference"/>
<attr name="bottomToolBarColor" format="color" />
@ -31,6 +32,9 @@
<attr name="ic_world_globe" format="reference" />
<attr name="plugin_description_header_text_color" format="color|reference" />
<attr name="expandable_list_item_background" format="color"/>
<attr name="expandable_list_background" format="color"/>
<attr name="list_settings_icon" format="reference"/>
<attr name="size_progress_bar" format="reference"/>
</declare-styleable>
<declare-styleable name="PagerSlidingTabStrip">

View file

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="expandable_list_item_dark">#292f33</color>
<color name="list_divider_dark">#1f2326</color>
<color name="list_divider_light">@color/color_white</color>
<color name="list_background_dark">#292f33</color>
<color name="list_sub_menu_background_dark">#475259</color>
<color name="expandable_list_item_light">@color/color_white</color>
<color name="list_item_background_dark">#333b40</color>
<color name="actionbar_dark_color">#39464d</color>
<color name="tool_bar_color_dark">#CC080B0D</color>
@ -108,7 +114,7 @@
<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>

View file

@ -26,8 +26,21 @@
<dimen name="list_header_padding">8dp</dimen>
<dimen name="tab_height">48dp</dimen>
<dimen name="list_item_height">50dp</dimen>
<dimen name="list_header_height">40dp</dimen>
<dimen name="list_header_top_margin">16dp</dimen>
<dimen name="list_header_settings_top_margin">10dp</dimen>
<dimen name="list_header_text_left_margin">12dp</dimen>
<dimen name="list_header_bottom_margin">8dp</dimen>
<dimen name="bottom_tool_bar_size">48dp</dimen>
<dimen name="favorites_icon_right_margin">18dp</dimen>
<dimen name="favorites_icon_top_margin">13dp</dimen>
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
<dimen name="dialog_content_margin">24dp</dimen>
<dimen name="dialog_content_bottom_margin">16dp</dimen>
<dimen name="local_size_height">34dp</dimen>
<!-- TextSizes -->
<dimen name="list_header_text_size">14sp</dimen>
<dimen name="showAllButtonTextSize">12sp</dimen>
<dimen name="subHeaderTextSize">14sp</dimen>
<dimen name="dashFavNameTextSize">16sp</dimen>

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="free">Free %1$s </string>
<string name="device_memory">Device memory</string>
<string name="rendering_attr_pisteGrooming_name">Piste grooming</string>
<string name="plugin_ski_name">Ski Maps</string>
<string name="plugin_nautical_name">Nautical Maps</string>

View file

@ -119,6 +119,7 @@
</style>
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
<item name="list_divider">@color/list_divider_dark</item>
<item name="reset_image">@drawable/ic_action_delete_light</item> <!-- @drawable/a_1_navigation_cancel_light -->
<item name="expandable_category_color">?android:attr/colorBackground</item>
<item name="bottomToolBarColor">@color/tool_bar_color_light</item>
@ -161,9 +162,13 @@
<item name="ic_world_globe">@drawable/ic_world_globe_light</item>
<item name="plugin_description_header_text_color">#727272</item>
<item name="expandable_list_item_background">@color/expandable_list_item_light</item>
<item name="expandable_list_background">@color/color_white</item>
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
<item name="list_divider">@color/list_divider_light</item>
<item name="reset_image">@drawable/ic_action_delete_dark</item> <!-- @drawable/a_1_navigation_cancel_dark -->
<item name="expandable_category_color">?android:attr/colorBackground</item>
<item name="bottomToolBarColor">@color/tool_bar_color_dark</item>
@ -194,12 +199,15 @@
<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_header_bg">@color/list_item_background_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>
<item name="expandable_list_item_background">@color/expandable_list_item_dark</item>
</style>
<item name="expandable_list_item_background">@color/list_item_background_dark</item>
<item name="expandable_list_background">@color/list_background_dark</item>
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
</style>
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/actionbar_dark_color</item>

View file

@ -137,7 +137,7 @@ public class ContextMenuAdapter {
if (holoLight) {
return ctx.getResources().getColor(R.color.color_white);
} else {
return ctx.getResources().getColor(R.color.dark_drawer_bg_color);
return ctx.getResources().getColor(R.color.list_background_dark);
}
}

View file

@ -804,19 +804,6 @@ public class OsmandApplication extends Application {
}
setLanguage(c);
c.setTheme(t);
if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_DARK_ACTIONBAR_THEME
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ActionBar ab = null;
if (c instanceof ActionBarActivity) {
ab = ((ActionBarActivity) c).getSupportActionBar();
}
if (ab != null) {
BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped);
bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
ab.setBackgroundDrawable(bg);
}
}
}
public IBRouterService getBRouterService() {

View file

@ -1756,7 +1756,7 @@ public class OsmandSettings {
public static final int OSMAND_DARK_THEME = 0;
public static final int OSMAND_LIGHT_THEME = 1;
public static final int OSMAND_LIGHT_DARK_ACTIONBAR_THEME = 2;
public final CommonPreference<Integer> SEARCH_TAB =
new IntPreference("SEARCH_TAB", 0).makeGlobal().cache();
@ -1771,18 +1771,11 @@ public class OsmandSettings {
return OSMAND_THEME.get() == OSMAND_LIGHT_THEME;
}
public boolean isLightContentMenu(){
return OSMAND_THEME.get() != OSMAND_DARK_THEME || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
}
public boolean isLightContent(){
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
return false;
}
return OSMAND_THEME.get() != OSMAND_DARK_THEME ;
}
public final CommonPreference<Boolean> FLUORESCENT_OVERLAYS =
new BooleanPreference("fluorescent_overlays", false).makeGlobal().cache();

View file

@ -12,7 +12,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import android.content.pm.ActivityInfo;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBarActivity;
@ -322,7 +321,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false);
getView().findViewById(R.id.DescriptionText).setVisibility(View.GONE);
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
runSelection(false);
listAdapter.notifyDataSetChanged();
}
@ -384,15 +383,15 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
@Override
public void onDestroyActionMode(ActionMode mode) {
enableSelectionMode(false);
getView().findViewById(R.id.DescriptionText).setVisibility(View.GONE);
getView().findViewById(R.id.memory_size).setVisibility(View.GONE);
listAdapter.notifyDataSetChanged();
}
});
if (R.string.local_index_mi_upload_gpx == actionResId) {
((TextView) getView().findViewById(R.id.DescriptionText)).setText(R.string.local_index_upload_gpx_description);
((TextView) getView().findViewById(R.id.DescriptionText)).setVisibility(View.VISIBLE);
((TextView) getView().findViewById(R.id.memory_size)).setText(R.string.local_index_upload_gpx_description);
((TextView) getView().findViewById(R.id.memory_size)).setVisibility(View.VISIBLE);
}
listAdapter.notifyDataSetChanged();
}

View file

@ -18,7 +18,10 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.MenuItem;
import net.osmand.Location;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
@ -35,12 +38,14 @@ import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import android.widget.TextView;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
/**
*
*/
public class FavoritesActivity extends TabActivity {
public class FavoritesActivity extends TabActivity implements OsmAndLocationProvider.OsmAndCompassListener, OsmAndLocationProvider.OsmAndLocationListener {
private static final String FAVOURITES_INFO = "FAVOURITES_INFO";
private static final String TRACKS = "TRACKS";
@ -119,12 +124,28 @@ public class FavoritesActivity extends TabActivity {
updateSelectedTracks();
}
});
if (getMyApplication().getFavorites().getFavouritePoints().size() > 0) {
getLocationProvider().addCompassListener(this);
getLocationProvider().registerOrUnregisterCompassListener(true);
}
}
public OsmandApplication getMyApplication() {
return (OsmandApplication) getApplication();
}
private OsmAndLocationProvider getLocationProvider() {
return getMyApplication().getLocationProvider();
}
@Override
protected void onPause() {
super.onPause();
((OsmandApplication) getApplication()).getSelectedGpxHelper().setUiListener(FavoritesActivity.class, null);
getLocationProvider().pauseAllUpdates();
getLocationProvider().removeLocationListener(this);
getLocationProvider().removeCompassListener(this);
}
public void updateSelectedTracks() {
@ -196,5 +217,25 @@ public class FavoritesActivity extends TabActivity {
}
}
@Override
public void updateCompassValue(float value) {
for (WeakReference<Fragment> ref : fragList) {
Fragment f = ref.get();
if (f instanceof FavoritesTreeFragment && !f.isDetached()) {
((FavoritesTreeFragment) f).updateCompassValue(value);
}
}
}
@Override
public void updateLocation(Location location) {
for (WeakReference<Fragment> ref : fragList) {
Fragment f = ref.get();
if (f instanceof FavoritesTreeFragment && !f.isDetached()) {
((FavoritesTreeFragment) f).updateLocation(location);
}
}
}
}

View file

@ -8,6 +8,7 @@ import java.util.Comparator;
import java.util.List;
import android.support.v4.app.ListFragment;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
import android.view.*;
import net.osmand.data.FavouritePoint;
@ -115,18 +116,10 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
FavouritePoint point = favouritesAdapter.getItem(position);
String name = getString(R.string.favorite) + ": " + point.getName();
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
View.OnClickListener onshow = new View.OnClickListener() {
@Override
public void onClick(View v) {
settings.SHOW_FAVORITES.set(true);
}
};
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
qa.setAnchor(v);
DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(), getActivity(),
true, false);
MapActivityActions.showObjectContextMenu(qa, getActivity(), onshow);
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
getActivity(), true, false);
optionsMenu.show();
} else {
Intent intent = getActivity().getIntent();
intent.putExtra(SELECT_FAVORITE_POINT_INTENT_KEY, favouritesAdapter.getItem(position));

View file

@ -1,14 +1,19 @@
package net.osmand.plus.activities;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.view.ActionMode;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.SearchView;
import android.view.*;
import gnu.trove.list.array.TIntArrayList;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
@ -18,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.osmand.Location;
import net.osmand.access.AccessibleToast;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
@ -29,11 +35,14 @@ 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;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.util.MapUtils;
@ -47,8 +56,6 @@ import android.graphics.Typeface;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
@ -83,6 +90,9 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
private ActionMode actionMode;
private SearchView searchView;
protected LatLon loc = null;
protected Float heading = null;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
@ -125,6 +135,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
// final LatLon mapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
favouritesAdapter.synchronizeGroups();
loc = getMyApplication().getSettings().getLastKnownMapLocation();
if(favouritesAdapter.getGroupCount() > 0 &&
"".equals(favouritesAdapter.getGroup(0).name)) {
getExpandableListView().expandGroup(0);
@ -153,43 +164,45 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
}
updateSelectionMode(actionMode);
} else {
final FavouritePoint point = (FavouritePoint) favouritesAdapter.getChild(groupPosition, childPosition);
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
qa.setAnchor(v);
final OsmandSettings settings = getMyApplication().getSettings();
final FavouritePoint point = (FavouritePoint) favouritesAdapter.getChild(groupPosition, childPosition);
String name = getString(R.string.favorite) + ": " + point.getName();
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
OnClickListener onshow = new OnClickListener() {
@Override
public void onClick(View v) {
settings.SHOW_FAVORITES.set(true);
}
};
DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(),
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
getActivity(), true, false);
Item edit = qa.item(R.string.favourites_context_menu_edit).icons(
R.drawable.ic_action_edit_dark, R.drawable.ic_action_edit_light);
edit.listen(
new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
editPoint(point);
return true;
}
}).reg();
Item delete = qa.item(R.string.favourites_context_menu_delete).icons(
R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_light);
delete.listen(
new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
deletePoint(point);
return true;
}
}).reg();
MapActivityActions.showObjectContextMenu(qa, getActivity(), onshow);
// DirectionsDialogs.createDirectionsActions(qa, location, point, name, settings.getLastKnownMapZoom(),
// getActivity(), true, false);
boolean light = getMyApplication().getSettings().isLightContent();
MenuItem item = optionsMenu.getMenu().add(R.string.favourites_context_menu_edit)
.setIcon(light ? R.drawable.ic_action_edit_light : R.drawable.ic_action_edit_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
editPoint(point);
return true;
}
});
item = optionsMenu.getMenu().add(R.string.favourites_context_menu_delete)
.setIcon(light ? R.drawable.ic_action_delete_light : R.drawable.ic_action_delete_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
deletePoint(point);
return true;
}
});
optionsMenu.show();
}
return true;
}
@ -737,9 +750,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
} else {
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_enabled_light
: R.drawable.ic_action_settings_enabled_dark));
ch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -761,7 +771,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
row = inflater.inflate(R.layout.favourites_list_item, parent, false);
}
TextView label = (TextView) row.findViewById(R.id.favourite_label);
TextView name = (TextView) row.findViewById(R.id.favourite_label);
TextView distanceText = (TextView) row.findViewById(R.id.distance);
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
final FavouritePoint model = (FavouritePoint) getChild(groupPosition, childPosition);
row.setTag(model);
@ -770,11 +781,19 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
label.setText(distance + model.getName(), TextView.BufferType.SPANNABLE);
label.setTypeface(Typeface.DEFAULT, model.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
((Spannable) label.getText()).setSpan(
new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length() - 1,
0);
name.setText(model.getName(), TextView.BufferType.SPANNABLE);
name.setTypeface(Typeface.DEFAULT, model.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
distanceText.setText(distance);
distanceText.setTextColor(getResources().getColor(R.color.color_distance));
row.findViewById(R.id.group_image).setVisibility(View.GONE);
if(loc != null){
ImageView direction = (ImageView) row.findViewById(R.id.direction);
direction.setVisibility(View.VISIBLE);
DashLocationFragment.updateArrow(getActivity(), loc, new LatLon(model.getLatitude(), model.getLongitude()), direction,
10, R.drawable.ic_destination_arrow, heading);
}
final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
if (selectionMode) {
ch.setVisibility(View.VISIBLE);
@ -862,5 +881,33 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
}
}
public void updateLocation(Location location) {
//This is used as origin for both Fav-list and direction arrows
if (getMyApplication().getSettings().getLastKnownMapLocation() != null) {
loc = getMyApplication().getSettings().getLastKnownMapLocation();
} else {
loc = new LatLon(0f, 0f);
}
updateArrows();
}
public boolean updateCompassValue(float value) {
//heading = value;
//updateArrows();
//99 in next line used to one-time initalize arrows (with reference vs. fixed-north direction) on non-compass devices
float lastHeading = heading != null ? heading : 99;
heading = value;
if (heading != null && Math.abs(MapUtils.degreesDiff(lastHeading, heading)) > 5) {
updateArrows();
return true;
} else {
heading = lastHeading;
}
return false;
}
private void updateArrows(){
favouritesAdapter.notifyDataSetChanged();
}
}

View file

@ -26,7 +26,6 @@ import net.osmand.plus.render.MapRenderRepositories;
import net.osmand.plus.sherpafy.TourViewActivity;
import net.osmand.plus.views.controls.FloatingActionButton;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
@ -139,9 +138,9 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
@Override
public void onPause() {
super.onPause();
getMyApplication().getLocationProvider().pauseAllUpdates();
getMyApplication().getLocationProvider().removeLocationListener(this);
getMyApplication().getLocationProvider().removeCompassListener(this);
getLocationProvider().pauseAllUpdates();
getLocationProvider().removeLocationListener(this);
getLocationProvider().removeCompassListener(this);
}
@Override

View file

@ -317,7 +317,7 @@ public class MapActivityActions implements DialogProvider {
final Builder builder = new AlertDialog.Builder(mapActivity);
final ArrayAdapter<?> listAdapter =
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
adapter.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener() {
@Override
@ -641,12 +641,8 @@ public class MapActivityActions implements DialogProvider {
public void prepareOptionsMenu(final ContextMenuAdapter cm) {
refreshDrawer = false;
final ArrayAdapter<?> listAdapter =
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContentMenu());
cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
mDrawerList.setAdapter(listAdapter);
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider));
final int colorHint = cm.getBackgroundColor(mapActivity, getMyApplication().getSettings().isLightContentMenu());
mDrawerList.setBackgroundColor(colorHint);
mDrawerList.setCacheColorHint(colorHint);
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
@ -945,12 +941,6 @@ public class MapActivityActions implements DialogProvider {
ArrayAdapter<Object> listAdapter = waypointDialogHelper.getWaypointsDrawerAdapter(mapActivity, running, flat);
mDrawerList.setAdapter(listAdapter);
refreshDrawer = false;
mDrawerList.setDivider(mapActivity.getResources().getDrawable(R.drawable.drawer_divider));
final int color = getMyApplication().getSettings().isLightContentMenu() ? mapActivity
.getResources().getColor(R.color.color_white) : mapActivity.getResources().getColor(
R.color.dark_drawer_bg_color);
mDrawerList.setBackgroundColor(color);
mDrawerList.setCacheColorHint(color);
mDrawerList.setOnItemClickListener(waypointDialogHelper.getDrawerItemClickListener(mapActivity, running,
listAdapter, null));
}

View file

@ -292,7 +292,7 @@ public class MapActivityLayers {
it.reg();
}
Builder builder = new AlertDialog.Builder(activity);
ListAdapter listAdapter =adapter.createListAdapter(activity, app.getSettings().isLightContentMenu());
ListAdapter listAdapter =adapter.createListAdapter(activity, app.getSettings().isLightContent());
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
@Override

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.PopupMenu;
import android.view.*;
import gnu.trove.list.array.TIntArrayList;
@ -630,9 +631,10 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
String name = app.getString(R.string.favorite) + ": " + child.name;
LatLon location = new LatLon(child.locationStart.lat, child.locationStart.lon);
OsmandSettings settings = app.getSettings();
DirectionsDialogs.createDirectionsActions(qa, location, child.locationStart, name, settings.getLastKnownMapZoom(), getMyActivity(),
true, false);
MapActivityActions.showObjectContextMenu(qa, getMyActivity(), null);
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, child.locationStart, name, settings.getLastKnownMapZoom(),
getActivity(), true, false);
optionsMenu.show();
} else {
child.expanded = !child.expanded;
adapter.notifyDataSetInvalidated();

View file

@ -10,6 +10,7 @@ import java.util.Locale;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
import android.view.*;
import android.view.MenuItem.OnMenuItemClickListener;
@ -227,12 +228,11 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Place item = adapter.getItem(position);
ContextMenuAdapter qa = new ContextMenuAdapter(view.getContext());
qa.setAnchor(view);
DirectionsDialogs.createDirectionsActions(qa, new LatLon(item.lat, item.lon), item,
getString(R.string.address)+ " : " + item.displayName, Math.max(15, settings.getLastKnownMapZoom()),
final PopupMenu optionsMenu = new PopupMenu(getActivity(), view);
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(item.lat, item.lon), item,
getString(R.string.address) + " : " + item.displayName, Math.max(15, settings.getLastKnownMapZoom()),
getActivity(), true);
MapActivityActions.showObjectContextMenu(qa, getActivity(), null);
optionsMenu.show();
}
private static class Place {

View file

@ -3,6 +3,7 @@ package net.osmand.plus.activities.search;
import java.util.List;
import android.support.v4.app.ListFragment;
import android.support.v7.widget.PopupMenu;
import android.view.*;
import net.osmand.data.LatLon;
import net.osmand.plus.ContextMenuAdapter;
@ -114,19 +115,12 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
}
private void selectModel(final HistoryEntry model, View v) {
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
qa.setAnchor(v);
String name = model.getName();
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
OsmandSettings settings = ((OsmandApplication) getActivity().getApplication()).getSettings();
OnClickListener onShow = new View.OnClickListener() {
@Override
public void onClick(View v) {
helper.selectEntry(model);
}
};
DirectionsDialogs.createDirectionsActions(qa, new LatLon(model.getLat(), model.getLon()),
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(model.getLat(), model.getLon()),
model, name, settings.getLastKnownMapZoom(), getActivity(), false);
MapActivityActions.showObjectContextMenu(qa, getActivity(), onShow);
optionsMenu.show();
}
class HistoryAdapter extends ArrayAdapter<HistoryEntry> {

View file

@ -4,6 +4,9 @@
package net.osmand.plus.activities.search;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.Toolbar;
import gnu.trove.set.hash.TLongHashSet;
@ -284,6 +287,14 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
addFooterView();
amenityAdapter = new AmenityAdapter(new ArrayList<Amenity>());
setListAdapter(amenityAdapter);
boolean light = getMyApplication().getSettings().isLightContent();
Drawable arrowImage = getResources().getDrawable(R.drawable.ic_destination_arrow_white);
if (light) {
arrowImage.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
} else {
arrowImage.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
}
@ -558,21 +569,19 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
@Override
public void onItemClick(AdapterView<?> parent,final View view, int position, long id) {
final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
ContextMenuAdapter adapter = new ContextMenuAdapter(view.getContext());
adapter.setAnchor(view);
String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), settings.usingEnglishNames());
String name = poiSimpleFormat;
int z = Math.max(16, settings.getLastKnownMapZoom());
DirectionsDialogs.createDirectionsActions(adapter, amenity.getLocation(), amenity, name, z, this, true );
final PopupMenu optionsMenu = new PopupMenu(this, view);
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, amenity.getLocation(), amenity, name, z, this, true);
final String d = OsmAndFormatter.getAmenityDescriptionContent(getMyApplication(), amenity, false);
if(d.toString().trim().length() > 0) {
Item poiDescr = adapter.item(R.string.poi_context_menu_showdescription).icons(
R.drawable.ic_action_note_dark, R.drawable.ic_action_note_light);
poiDescr.listen(new OnContextMenuClick() {
MenuItem item = optionsMenu.getMenu().add(R.string.poi_context_menu_showdescription).
setIcon(getMyApplication().getSettings().isLightContent() ?
R.drawable.ic_action_note_light : R.drawable.ic_action_note_dark);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onMenuItemClick(MenuItem item) {
// Build text(amenity)
// Find and format links
@ -592,20 +601,19 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
textView.setLinksClickable(true);
return true;
}
}).reg();
});
}
if (((OsmandApplication)getApplication()).accessibilityEnabled()) {
Item showDetails = adapter.item(R.string.show_details);
showDetails.listen(new OnContextMenuClick() {
MenuItem item = optionsMenu.getMenu().add(R.string.show_details);
item.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onMenuItemClick(MenuItem item) {
showPOIDetails(amenity, settings.usingEnglishNames());
return true;
}
}).reg();
});
}
MapActivityActions.showObjectContextMenu(adapter, this, null);
optionsMenu.show();
}
@ -760,6 +768,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
}
float[] mes = null;
TextView label = (TextView) row.findViewById(R.id.poi_label);
TextView distanceText = (TextView) row.findViewById(R.id.distance);
ImageView direction = (ImageView) row.findViewById(R.id.poi_direction);
ImageView icon = (ImageView) row.findViewById(R.id.poi_icon);
Amenity amenity = getItem(position);
@ -785,7 +794,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
}
}
if(loc != null){
DirectionDrawable draw = new DirectionDrawable(SearchPOIActivity.this, width, height);
DirectionDrawable draw = new DirectionDrawable(SearchPOIActivity.this, width, height, R.drawable.ic_destination_arrow_white);
Float h = heading;
float a = h != null ? h : 0;
@ -844,8 +853,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
distance = " " + OsmAndFormatter.getFormattedDistance((int) mes[0], getMyApplication()) + " "; //$NON-NLS-1$
}
String poiType = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.usingEnglishNames());
label.setText(distance + poiType, TextView.BufferType.SPANNABLE);
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length() - 1, 0);
label.setText(poiType);
distanceText.setText(distance);
return (row);
}

View file

@ -122,7 +122,7 @@ public class DashAudioVideoNotesActivity extends OsmandActionBarActivity {
if (light) {
row.setBackgroundColor(getResources().getColor(R.color.expandable_list_item_light));
} else {
row.setBackgroundColor(getResources().getColor(R.color.expandable_list_item_dark));
row.setBackgroundColor(getResources().getColor(R.color.list_item_background_dark));
}
final AudioVideoNotesPlugin.Recording recording = getItem(position);
DashAudioVideoNotesFragment.getNoteView(recording, row, DashAudioVideoNotesActivity.this, plugin);

View file

@ -139,8 +139,8 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
if(loc != null){
direction.setVisibility(View.VISIBLE);
updateArrow(new LatLon(point.getLatitude(), point.getLongitude()), direction,
10, R.drawable.ic_destination_arrow);
updateArrow(getActivity(), loc, new LatLon(point.getLatitude(), point.getLongitude()), direction,
10, R.drawable.ic_destination_arrow, heading);
}
arrows.add(direction);
name.setText(point.getName());
@ -177,8 +177,8 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
for (int i = 0; i < arrows.size(); i++) {
arrows.get(i).setVisibility(View.VISIBLE);
updateArrow(new LatLon(points.get(i).getLatitude(),points.get(i).getLongitude()),
arrows.get(i), 10, R.drawable.ic_destination_arrow);
updateArrow(getActivity(), loc, new LatLon(points.get(i).getLatitude(), points.get(i).getLongitude()),
arrows.get(i), 10, R.drawable.ic_destination_arrow, heading);
}
}

View file

@ -1,5 +1,6 @@
package net.osmand.plus.dashboard;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
@ -36,16 +37,17 @@ public class DashLocationFragment extends DashBaseFragment {
}
}
protected void updateArrow(LatLon l, ImageView direction, int size, int resourceId) {
public static void updateArrow(Activity ctx, LatLon currentLocation, LatLon pointLocation,
ImageView direction, int size, int resourceId, Float heading) {
float[] mes = new float[2];
Location.distanceBetween(l.getLatitude(), l.getLongitude(), loc.getLatitude(), loc.getLongitude(), mes);
DirectionDrawable draw = new DirectionDrawable(getActivity(), size, size, resourceId);
Location.distanceBetween(pointLocation.getLatitude(), pointLocation.getLongitude(), currentLocation.getLatitude(), currentLocation.getLongitude(), mes);
DirectionDrawable draw = new DirectionDrawable(ctx, size, size, resourceId);
Float h = heading;
float a = h != null ? h : 0;
//Hardy: getRotation() is the correction if device's screen orientation != the default display's standard orientation
int screenOrientation = 0;
screenOrientation = ((WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
screenOrientation = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
switch (screenOrientation)
{
case ORIENTATION_0: // Device default (normally portrait)
@ -63,7 +65,7 @@ public class DashLocationFragment extends DashBaseFragment {
}
//Looks like screenOrientation correction must not be applied for devices without compass?
Sensor compass = ((SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
Sensor compass = ((SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
if (compass == null) {
screenOrientation = 0;
}

View file

@ -14,8 +14,14 @@ import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.widget.PopupMenu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class DirectionsDialogs {
public static void directionsToDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
@ -46,65 +52,67 @@ public class DirectionsDialogs {
}
}
public static void createDirectionsActions(final ContextMenuAdapter qa , final LatLon location, final Object obj, final String name,
final int z, final Activity activity, final boolean saveHistory) {
createDirectionsActions(qa, location, obj, name, z, activity, saveHistory, true);
public static void createDirectionsActionsPopUpMenu(final PopupMenu optionsMenu , final LatLon location, final Object obj, final String name,
final int z, final Activity activity, final boolean saveHistory) {
createDirectionActionsPopUpMenu(optionsMenu, location, obj, name, z, activity, saveHistory, true);
}
public static void createDirectionsActions(final ContextMenuAdapter qa , final LatLon location, final Object obj, final String name,
final int z, final Activity activity, final boolean saveHistory, boolean favorite) {
public static void createDirectionActionsPopUpMenu(final PopupMenu optionsMenu, final LatLon location, final Object obj, final String name,
final int z, final Activity activity, final boolean saveHistory, boolean favorite) {
setupPopUpMenuIcon(optionsMenu);
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
boolean light = app.getSettings().isLightContent();
final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
Item dir = qa.item(R.string.context_menu_item_directions_to).icons(
R.drawable.ic_action_gdirections_dark, R.drawable.ic_action_gdirections_light);
dir.listen(
new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
return true;
}
}).reg();
Item intermediate;
if (targetPointsHelper.getPointToNavigate() != null) {
intermediate = qa.item(R.string.context_menu_item_intermediate_point).icons(
R.drawable.ic_action_flage_dark,R.drawable.ic_action_flage_light);
} else {
intermediate = qa.item(R.string.context_menu_item_destination_point).icons(
R.drawable.ic_action_flag_dark, R.drawable.ic_action_flag_light);
}
intermediate.listen(new OnContextMenuClick() {
MenuItem item = optionsMenu.getMenu().add(
R.string.context_menu_item_directions_to).setIcon(light ?
R.drawable.ic_action_gdirections_light : R.drawable.ic_action_gdirections_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
public boolean onMenuItemClick(MenuItem item) {
DirectionsDialogs.directionsToDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
optionsMenu.dismiss();
return true;
}
}).reg();
});
Item showOnMap = qa.item(R.string.show_poi_on_map).icons(
R.drawable.ic_action_marker_dark, R.drawable.ic_action_marker_light );
showOnMap.listen(
new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
obj); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(activity);
return true;
}
}).reg();
if (targetPointsHelper.getPointToNavigate() != null) {
item = optionsMenu.getMenu().add(
R.string.context_menu_item_intermediate_point).setIcon(light ?
R.drawable.ic_action_flage_light : R.drawable.ic_action_flage_dark);
} else {
item = optionsMenu.getMenu().add(
R.string.context_menu_item_destination_point).setIcon(light ?
R.drawable.ic_action_flag_light : R.drawable.ic_action_flag_dark);
}
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
DirectionsDialogs.addWaypointDialogAndLaunchMap(activity, location.getLatitude(), location.getLongitude(), name);
optionsMenu.dismiss();
return true;
}
});
item = optionsMenu.getMenu().add(
R.string.show_poi_on_map).setIcon(light ?
R.drawable.ic_action_marker_light : R.drawable.ic_action_marker_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
obj); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(activity);
return true;
}
});
if (favorite) {
Item addToFavorite = qa.item(R.string.add_to_favourite).icons(
R.drawable.ic_action_fav_dark, R.drawable.ic_action_fav_light);
addToFavorite.listen(new OnContextMenuClick() {
item = optionsMenu.getMenu().add(
R.string.add_to_favourite).setIcon(light ?
R.drawable.ic_action_fav_light : R.drawable.ic_action_fav_dark);
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
public boolean onMenuItemClick(MenuItem item) {
Bundle args = new Bundle();
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(activity, args);
dlg.show();
@ -112,10 +120,10 @@ public class DirectionsDialogs {
name);
return true;
}
}).reg();
});
}
}
public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
@ -148,4 +156,24 @@ public class DirectionsDialogs {
MapActivity.launchMapActivityMoveToTop(act);
}
}
private static void setupPopUpMenuIcon(PopupMenu menu){
try {
Field[] fields = menu.getClass().getDeclaredFields();
for (Field field : fields) {
if ("mPopup".equals(field.getName())) {
field.setAccessible(true);
Object menuPopupHelper = field.get(menu);
Class<?> classPopupHelper = Class.forName(menuPopupHelper
.getClass().getName());
Method setForceIcons = classPopupHelper.getMethod(
"setForceShowIcon", boolean.class);
setForceIcons.invoke(menuPopupHelper, true);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -6,11 +6,8 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import android.app.FragmentManager;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v4.app.FragmentPagerAdapter;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -111,7 +108,7 @@ public class DownloadActivity extends BaseDownloadActivity {
settings = ((OsmandApplication)getApplication()).getSettings();
indeterminateProgressBar = (ProgressBar) findViewById(R.id.IndeterminateProgressBar);
determinateProgressBar = (ProgressBar) findViewById(R.id.DeterminateProgressBar);
determinateProgressBar = (ProgressBar) findViewById(R.id.memory_progress);
progressView = findViewById(R.id.ProgressView);
progressMessage = (TextView) findViewById(R.id.ProgressMessage);
progressPercent = (TextView) findViewById(R.id.ProgressPercent);

View file

@ -31,9 +31,6 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
private Map<String, String> indexFileNames = null;
private Map<String, String> indexActivatedFileNames = null;
private int okColor;
private int defaultColor;
private int updateColor;
private OsmandRegions osmandRegions;
private java.text.DateFormat format;
private OsmandApplication app;
@ -45,11 +42,8 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
app = downloadFragment.getMyApplication();
list = new ArrayList<IndexItemCategory>(IndexItemCategory.categorizeIndexItems(app, indexFiles));
format = downloadFragment.getMyApplication().getResourceManager().getDateFormat();
okColor = downloadFragment.getResources().getColor(R.color.color_ok);
TypedArray ta = downloadFragment.getDownloadActivity().getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary});
defaultColor = ta.getColor(0, downloadFragment.getResources().getColor(R.color.color_unknown));
ta.recycle();
updateColor = downloadFragment.getResources().getColor(R.color.color_update);
osmandRegions = downloadFragment.getMyApplication().getResourceManager().getOsmandRegions();
}
@ -233,13 +227,15 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
v = inflater.inflate(net.osmand.plus.R.layout.download_index_list_item, parent, false);
}
final View row = v;
TextView item = (TextView) row.findViewById(R.id.download_item);
TextView name = (TextView) row.findViewById(R.id.name);
TextView edition = (TextView) row.findViewById(R.id.update_descr);
edition.setText("");
TextView description = (TextView) row.findViewById(R.id.download_descr);
IndexItem e = (IndexItem) getChild(groupPosition, childPosition);
OsmandApplication clctx = downloadFragment.getMyApplication();
String eName = e.getVisibleDescription(clctx) + "\n" + e.getVisibleName(clctx, osmandRegions);
item.setText(eName.trim()); //$NON-NLS-1$
String d = e.getDate(format) + "\n" + e.getSizeDescription(clctx);
String eName = e.getVisibleName(clctx, osmandRegions);
name.setText(eName.trim()); //$NON-NLS-1$
String d = e.getDate(format) + " " + e.getSizeDescription(clctx);
description.setText(d.trim());
CheckBox ch = (CheckBox) row.findViewById(R.id.check_download_item);
@ -254,50 +250,35 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem
});
if (indexFileNames != null) {
if (!e.isAlreadyDownloaded(indexFileNames)) {
item.setTextColor(defaultColor);
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else {
if(e.getType() == DownloadActivityType.HILLSHADE_FILE
|| e.getType() == DownloadActivityType.SRTM_COUNTRY_FILE){
item.setTextColor(okColor); // GREEN
if (e.isAlreadyDownloaded(indexFileNames)) {
if (e.getType() == DownloadActivityType.HILLSHADE_FILE
|| e.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
String sfName = e.getTargetFileName();
if (indexActivatedFileNames.containsKey(sfName)) {
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
// next case since present hillshade files cannot be deactivated, but are not in indexActivatedFileNames
name.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
// next case since present hillshade files cannot be deactivated, but are not in indexActivatedFileNames
} else if (e.getType() == DownloadActivityType.HILLSHADE_FILE) {
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
name.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else {
item.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
name.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
}
} else if (e.getDate(format) != null) {
String sfName = e.getTargetFileName();
final boolean updatableResource = indexActivatedFileNames.containsKey(sfName);
if (updatableResource && !DownloadActivity.downloadListIndexThread.checkIfItemOutdated(e)) {
item.setText(item.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
edition.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
+ indexActivatedFileNames.get(sfName));
item.setTextColor(okColor); // GREEN
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else if (indexFileNames.containsKey(sfName) && !DownloadActivity.downloadListIndexThread.checkIfItemOutdated(e)) {
item.setText(item.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
edition.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
+ indexFileNames.get(sfName));
item.setTextColor(okColor);
item.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
} else if (updatableResource) {
item.setText(item.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
edition.setText(downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
+ indexActivatedFileNames.get(sfName));
item.setTextColor(updateColor); // LIGHT_BLUE
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else {
item.setText(item.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
edition.setText(name.getText() + "\n" + downloadFragment.getResources().getString(R.string.local_index_installed) + " : "
+ indexFileNames.get(sfName));
item.setTextColor(updateColor);
item.setTypeface(Typeface.DEFAULT, Typeface.ITALIC);
}
} else {
item.setTextColor(okColor);
item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
}
}
}

View file

@ -56,7 +56,7 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@ -81,12 +81,12 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
private ActionMode actionMode;
private TextView descriptionText;
private ProgressBar sizeProgress;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.local_index, container, false);
// getDownloadActivity().getSupportActionBar().setTitle(R.string.local_index_descr_title);
getDownloadActivity().setSupportProgressBarIndeterminateVisibility(false);
ExpandableListView listView = (ExpandableListView)view.findViewById(android.R.id.list);
@ -95,7 +95,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
expandAllGroups();
setListView(listView);
//getDownloadActivity().getSupportActionBar().setLogo(R.drawable.tab_download_screen_icon);
descriptionText = (TextView) view.findViewById(R.id.DescriptionText);
descriptionText = (TextView) view.findViewById(R.id.memory_size);
sizeProgress = (ProgressBar) view.findViewById(R.id.memory_progress);
updateDescriptionTextWithSize();
return view;
}
@ -528,15 +529,15 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
if (j + 1 >= max && optionsMenuAdapter.length() > max) {
if (split == null) {
split = menu.addSubMenu(0, 1, j + 1, R.string.default_buttons_other_actions);
split.setIcon(isLightActionBar() ? R.drawable.ic_overflow_menu_light : R.drawable.ic_overflow_menu_dark );
split.setIcon(R.drawable.ic_overflow_menu_white);
split.getItem();
MenuItemCompat.setShowAsAction(split.getItem(),MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
MenuItemCompat.setShowAsAction(split.getItem(),MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
}
item = split.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM );
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
} else {
item = menu.add(0, optionsMenuAdapter.getElementId(j), j + 1, optionsMenuAdapter.getItemName(j));
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM );
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS );
}
if (optionsMenuAdapter.getImageId(j, isLightActionBar()) != 0) {
item.setIcon(optionsMenuAdapter.getImageId(j, isLightActionBar()));
@ -658,12 +659,14 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
private void updateDescriptionTextWithSize(){
File dir = getMyApplication().getAppPath("").getParentFile();
String size = formatGb.format(new Object[]{0});
int percent = 0;
if(dir.canRead()){
StatFs fs = new StatFs(dir.getAbsolutePath());
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
size = formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
percent = (int) (fs.getAvailableBlocks() * 100 / fs.getBlockCount());
}
String text = getString(R.string.local_index_description, size);
sizeProgress.setProgress(percent);
String text = getString(R.string.free, size);
int l = text.indexOf('.');
if(l == -1) {
l = text.length();
@ -995,20 +998,17 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
LocalIndexInfo group = getGroup(groupPosition);
if (v == null) {
LayoutInflater inflater = (LayoutInflater) getDownloadActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(net.osmand.plus.R.layout.expandable_list_item_category, parent, false);
v = inflater.inflate(R.layout.local_index_list_category, parent, false);
}
StringBuilder t = new StringBuilder(group.getType().getHumanString(getDownloadActivity()));
StringBuilder name = new StringBuilder(group.getType().getHumanString(getDownloadActivity()));
if(group.getSubfolder() != null) {
t.append(" ").append(group.getSubfolder());
name.append(" ").append(group.getSubfolder());
}
if (group.isBackupedData()) {
t.append(" - ").append(getString(R.string.local_indexes_cat_backup));
name.append(" - ").append(getString(R.string.local_indexes_cat_backup));
}
v.findViewById(R.id.explist_indicator).setVisibility(View.GONE);
TextView nameView = ((TextView) v.findViewById(R.id.category_name));
nameView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TextView sizeView = ((TextView) v.findViewById(R.id.category_size));
List<LocalIndexInfo> list = data.get(group);
int size = 0;
for (LocalIndexInfo aList : list) {
@ -1020,16 +1020,17 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
size += sz;
}
}
String sz = "";
if (size > 0) {
String sz;
if (size > 1 << 20) {
sz = formatGb.format(new Object[] { (float) size / (1 << 20) });
} else {
sz = formatMb.format(new Object[] { (float) size / (1 << 10) });
}
t.append(" [").append(sz).append("]");
}
nameView.setText(t.toString());
sizeView.setText(sz);
nameView.setText(name.toString());
if (!group.isBackupedData()) {
nameView.setTypeface(Typeface.DEFAULT, Typeface.NORMAL);
} else {

View file

@ -110,8 +110,7 @@ public class UpdatesIndexFragment extends ListFragment {
item.setIcon(R.drawable.ic_action_refresh_dark);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
SubMenu s = menu.addSubMenu(0, DownloadIndexFragment.MORE_ID, 0, "");
s.setIcon(isLightActionBar() ? R.drawable.ic_overflow_menu_light
: R.drawable.ic_overflow_menu_dark);
s.setIcon(R.drawable.ic_overflow_menu_white);
s.add(0, DownloadIndexFragment.SELECT_ALL_ID, 0, R.string.select_all);
s.add(0, DownloadIndexFragment.DESELECT_ALL_ID, 0, R.string.deselect_all);
MenuItemCompat.setShowAsAction(s.getItem(), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);

View file

@ -62,7 +62,7 @@ public class AvoidSpecificRoads {
}
final RouteDataObject obj = getItem(position);
v.findViewById(R.id.all_points).setVisibility(View.GONE);
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageResource(app.getSettings().isLightContentMenu() ?
((ImageView) v.findViewById(R.id.waypoint_icon)).setImageResource(app.getSettings().isLightContent() ?
R.drawable.ic_action_road_works_light : R.drawable.ic_action_road_works_dark);
double dist = MapUtils.getDistance(mapLocation, MapUtils.get31LatitudeY(obj.getPoint31YTile(0)),
MapUtils.get31LongitudeX(obj.getPoint31XTile(0)));
@ -71,7 +71,7 @@ public class AvoidSpecificRoads {
((TextView) v.findViewById(R.id.waypoint_text)).setText(getText(obj));
ImageButton remove = (ImageButton) v.findViewById(R.id.info_close);
remove.setVisibility(View.VISIBLE);
remove.setImageResource(app.getSettings().isLightContentMenu() ?
remove.setImageResource(app.getSettings().isLightContent() ?
R.drawable.ic_action_gremove_light : R.drawable.ic_action_gremove_dark);
remove.setOnClickListener(new View.OnClickListener() {

View file

@ -232,7 +232,7 @@ public class GpxUiHelper {
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
Builder b = new AlertDialog.Builder(activity);
// final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
final boolean light = app.getSettings().isLightContentMenu();
final boolean light = app.getSettings().isLightContent();
final int layout;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
layout = R.layout.list_menu_item;

View file

@ -16,7 +16,6 @@ import net.osmand.plus.activities.AvailableGPXFragment.GpxInfo;
import net.osmand.plus.activities.EnumAdapter;
import net.osmand.plus.activities.EnumAdapter.IEnumWithResource;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.util.Algorithms;
import android.app.Activity;
@ -25,10 +24,6 @@ import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
@ -232,7 +227,7 @@ public class OsmEditingPlugin extends OsmandPlugin {
Builder bldr = new AlertDialog.Builder(la);
LayoutInflater inflater = (LayoutInflater)la.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View view = inflater.inflate(R.layout.send_gpx_osm, null);
final EditText descr = (EditText) view.findViewById(R.id.DescriptionText);
final EditText descr = (EditText) view.findViewById(R.id.memory_size);
if(info.length > 0 && info[0].getFileName() != null) {
int dt = info[0].getFileName().indexOf('.');
descr.setText(info[0].getFileName().substring(0, dt));

View file

@ -86,7 +86,7 @@ public class DashParkingFragment extends DashLocationFragment {
ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon);
if (loc != null){
direction.setVisibility(View.VISIBLE);
updateArrow(position, direction, 10, R.drawable.ic_destination_arrow);
updateArrow(getActivity(), loc, position, direction, 10, R.drawable.ic_destination_arrow, heading);
}
}

View file

@ -5,6 +5,8 @@ import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
/**
@ -53,9 +55,14 @@ public class DirectionDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
if (resourceId != -1) {
canvas.rotate(angle, canvas.getHeight()/2, canvas.getWidth()/2);
Bitmap arrow = BitmapFactory.decodeResource(ctx.getResources(), resourceId);
canvas.drawBitmap(arrow, null, new Rect(0,0,arrow.getHeight(), arrow.getWidth()), null);
canvas.rotate(angle, canvas.getHeight() / 2, canvas.getWidth() / 2);
Drawable arrowImage = ctx.getResources().getDrawable(resourceId);
Bitmap arrow = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
Canvas canv = new Canvas(arrow);
arrowImage.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
arrowImage.draw(canv);
canvas.drawBitmap(arrow, null, new Rect(0, 0, arrow.getHeight(), arrow.getWidth()), null);
} else {
canvas.rotate(angle, canvas.getHeight()/2, canvas.getWidth() / 2);
Path directionPath = createDirectionPath();