Updated lists design

This commit is contained in:
Denis 2015-02-11 13:29:25 +02:00
parent 36a8d36c9a
commit 4a2f288d50
13 changed files with 154 additions and 127 deletions

View file

@ -20,6 +20,7 @@
style="@style/OsmandListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
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">
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" />
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">
android:layout_marginLeft="@dimen/list_header_text_left_margin"
android:layout_marginTop="@dimen/list_header_settings_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:gravity="center_vertical"
android:visibility="gone" />
</LinearLayout>
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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
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">
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" />
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: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">
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:src="@drawable/ic_action_settings_enabled_dark"
android:layout_marginTop="@dimen/list_header_settings_top_margin"
android:focusable="false"
android:gravity="center_vertical" />
</LinearLayout>
android:src="?attr/list_settings_icon"/>
</LinearLayout>

View file

@ -6,18 +6,18 @@
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: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"

View file

@ -1,44 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_vertical"
android:paddingLeft="6dp"
android:paddingRight="3dp">
<ImageView
android:id="@+id/poi_direction"
android:layout_width="26dp"
android:layout_height="26dp" />
android:paddingLeft="@dimen/list_content_padding"
android:paddingRight="@dimen/list_content_padding">
<ImageView
android:id="@+id/poi_icon"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginLeft="3dp" />
</LinearLayout>
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:orientation="vertical"
android:paddingRight="3dp">
<TextView
android:id="@+id/poi_label"
style="@style/ListText.Small"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical" />
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:maxLines="1"
tools:text="@string/lorem_ipsum"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/poi_direction"
android:layout_width="@dimen/dashFavDirectionSize"
android:layout_height="@dimen/dashFavDirectionSize"
android:layout_gravity="center_vertical"
tools:visiblity="visible"/>
<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"/>
</LinearLayout>
</LinearLayout>

View file

@ -31,6 +31,8 @@
<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"/>
</declare-styleable>
<declare-styleable name="PagerSlidingTabStrip">

View file

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="expandable_list_item_dark">#292f33</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 +111,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,10 +26,17 @@
<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>
<!-- 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

@ -161,6 +161,8 @@
<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>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
@ -194,11 +196,13 @@
<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>
<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>
</style>
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">

View file

@ -745,9 +745,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) {

View file

@ -4,6 +4,8 @@
package net.osmand.plus.activities.search;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.Toolbar;
import gnu.trove.set.hash.TLongHashSet;
@ -285,6 +287,14 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
amenityAdapter = new AmenityAdapter(new ArrayList<Amenity>());
setListAdapter(amenityAdapter);
boolean light = getMyApplication().getSettings().isLightContent();
Drawable arrowImage = getResources().getDrawable(R.drawable.ic_destination_arrow);
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);
}
}
@ -760,6 +770,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 +796,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);
Float h = heading;
float a = h != null ? h : 0;
@ -844,8 +855,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

@ -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();