This commit is contained in:
GaidamakUA 2015-12-29 11:34:25 +02:00
parent 65c7ffa3da
commit 8cfbf26bc2
3 changed files with 37 additions and 28 deletions

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetTop="71dp"
android:insetLeft="56dp">
<shape android:shape="rectangle">
<size android:height="1dp"/>
<solid android:color="#F00"/>
<!--<solid android:color="@color/dashboard_divider_light"/>-->
</shape>
</inset>

View file

@ -1,38 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:background="?attr/bg_color" android:background="?attr/bg_color"
android:descendantFocusability="blocksDescendants" android:descendantFocusability="blocksDescendants"
android:minHeight="@dimen/list_item_height" android:minHeight="@dimen/list_item_height"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingLeft="@dimen/list_content_padding">
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/favorites_icon_right_margin" android:layout_marginRight="@dimen/favorites_icon_right_margin"
android:layout_marginTop="@dimen/favorites_icon_top_margin" android:layout_marginTop="@dimen/favorites_icon_top_margin"
android:focusable="false" android:focusable="false"
android:src="@drawable/ic_map"/> android:src="@drawable/ic_map"/>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_toLeftOf="@id/options"
android:layout_toRightOf="@id/icon"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/nameTextView" android:id="@+id/nameTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
android:lines="1"
android:ellipsize="end"
tools:text="Belarus"/> tools:text="Belarus"/>
<TextView <TextView
@ -42,8 +44,8 @@
android:layout_marginRight="7dp" android:layout_marginRight="7dp"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size" android:textSize="@dimen/default_sub_text_size"
tools:visibility="gone" tools:text="11.1 MB"
tools:text="11.1 MB"/> tools:visibility="gone"/>
<TextView <TextView
android:id="@+id/descriptionTextView" android:id="@+id/descriptionTextView"
@ -59,9 +61,18 @@
android:id="@+id/options" android:id="@+id/options"
android:layout_width="@dimen/list_item_height" android:layout_width="@dimen/list_item_height"
android:layout_height="@dimen/list_item_height" android:layout_height="@dimen/list_item_height"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/dashboard_button" android:background="?attr/dashboard_button"
android:focusable="false" android:focusable="false"
android:src="@drawable/ic_overflow_menu_white"/> android:src="@drawable/ic_overflow_menu_white"/>
</LinearLayout> <View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
</RelativeLayout>

View file

@ -177,7 +177,7 @@ public class LiveUpdatesFragment extends Fragment {
} else { } else {
viewHolder = (LocalFullMapsViewHolder) convertView.getTag(); viewHolder = (LocalFullMapsViewHolder) convertView.getTag();
} }
viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition)); viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition), isLastChild);
return convertView; return convertView;
} }
@ -294,6 +294,7 @@ public class LiveUpdatesFragment extends Fragment {
private final LiveUpdatesFragment fragment; private final LiveUpdatesFragment fragment;
private final View view; private final View view;
private final int secondaryColor; private final int secondaryColor;
private final View divider;
private LocalFullMapsViewHolder(View view, LiveUpdatesFragment context) { private LocalFullMapsViewHolder(View view, LiveUpdatesFragment context) {
icon = (ImageView) view.findViewById(R.id.icon); icon = (ImageView) view.findViewById(R.id.icon);
@ -308,9 +309,10 @@ public class LiveUpdatesFragment extends Fragment {
Resources.Theme theme = context.getActivity().getTheme(); Resources.Theme theme = context.getActivity().getTheme();
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true); theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
secondaryColor = typedValue.data; secondaryColor = typedValue.data;
divider = view.findViewById(R.id.divider);
} }
public void bindLocalIndexInfo(final LocalIndexInfo item) { public void bindLocalIndexInfo(final LocalIndexInfo item, boolean isLastChild) {
OsmandApplication context = fragment.getMyActivity().getMyApplication(); OsmandApplication context = fragment.getMyActivity().getMyApplication();
final OsmandSettings.CommonPreference<Boolean> shouldUpdatePreference = final OsmandSettings.CommonPreference<Boolean> shouldUpdatePreference =
preferenceLiveUpdatesOn(item, fragment.getSettings()); preferenceLiveUpdatesOn(item, fragment.getSettings());
@ -359,6 +361,12 @@ public class LiveUpdatesFragment extends Fragment {
}; };
options.setOnClickListener(clickListener); options.setOnClickListener(clickListener);
view.setOnClickListener(clickListener); view.setOnClickListener(clickListener);
if(isLastChild) {
divider.setVisibility(View.GONE);
}else {
divider.setVisibility(View.VISIBLE);
}
} }
private Drawable getSecondaryColorPaintedIcon(@DrawableRes int drawable) { private Drawable getSecondaryColorPaintedIcon(@DrawableRes int drawable) {