Item onClick animation and click on item to download
This commit is contained in:
parent
9b17607f7b
commit
2810c35d8e
8 changed files with 17 additions and 35 deletions
|
@ -2,6 +2,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
@ -9,13 +10,15 @@
|
||||||
android:paddingLeft="@dimen/list_header_padding"
|
android:paddingLeft="@dimen/list_header_padding"
|
||||||
android:paddingRight="@dimen/list_header_padding">
|
android:paddingRight="@dimen/list_header_padding">
|
||||||
|
|
||||||
<TextView
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/section_name"
|
android:id="@+id/section_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
tools:text="World Regions"/>
|
tools:text="World Regions"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -11,8 +11,6 @@
|
||||||
android:layout_height="@dimen/list_item_height"
|
android:layout_height="@dimen/list_item_height"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="16dp"
|
android:paddingLeft="16dp"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
|
|
|
@ -64,8 +64,6 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||||
android:background="?attr/dashboard_button"
|
android:background="?attr/dashboard_button"
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
tools:src="@drawable/ic_action_import"
|
tools:src="@drawable/ic_action_import"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
@ -76,7 +74,7 @@
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
android:text="BUY"
|
android:text="@string/buy"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<dimen name="list_header_text_left_margin">12dp</dimen>
|
<dimen name="list_header_text_left_margin">12dp</dimen>
|
||||||
<dimen name="list_header_bottom_margin">8dp</dimen>
|
<dimen name="list_header_bottom_margin">8dp</dimen>
|
||||||
|
|
||||||
<dimen name="favorites_icon_right_margin">18dp</dimen>
|
<dimen name="favorites_icon_right_margin">24dp</dimen>
|
||||||
<dimen name="local_index_check_right_margin">10dp</dimen>
|
<dimen name="local_index_check_right_margin">10dp</dimen>
|
||||||
<dimen name="favorites_icon_top_margin">13dp</dimen>
|
<dimen name="favorites_icon_top_margin">13dp</dimen>
|
||||||
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
|
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
|
||||||
|
|
|
@ -2000,4 +2000,5 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
||||||
<string name="downloading_number_of_files">Downloading - %1$d file</string>
|
<string name="downloading_number_of_files">Downloading - %1$d file</string>
|
||||||
<string name="show_free_version_banner">Show free version banner</string>
|
<string name="show_free_version_banner">Show free version banner</string>
|
||||||
<string name="show_free_version_banner_description">Even if you have paid version you still can see free version banner</string>
|
<string name="show_free_version_banner_description">Even if you have paid version you still can see free version banner</string>
|
||||||
|
<string name="buy">BUY</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -15,7 +15,6 @@ import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.WorldRegion;
|
import net.osmand.plus.WorldRegion;
|
||||||
import net.osmand.plus.download.BaseDownloadActivity;
|
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.download.IndexItem;
|
import net.osmand.plus.download.IndexItem;
|
||||||
|
@ -113,19 +112,9 @@ public class ItemViewHolder {
|
||||||
} else {
|
} else {
|
||||||
descrTextView.setText(indexItem.getSizeDescription(context));
|
descrTextView.setText(indexItem.getSizeDescription(context));
|
||||||
}
|
}
|
||||||
|
// TODO replace with imageView.
|
||||||
rightImageButton.setVisibility(View.VISIBLE);
|
rightImageButton.setVisibility(View.VISIBLE);
|
||||||
rightImageButton.setImageDrawable(getContextIcon(context, R.drawable.ic_action_import));
|
rightImageButton.setImageDrawable(getContextIcon(context, R.drawable.ic_action_import));
|
||||||
rightImageButton.setTag(R.id.index_item, indexItem);
|
|
||||||
rightImageButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
((BaseDownloadActivity) v.getContext())
|
|
||||||
.startDownload((IndexItem) v.getTag(R.id.index_item));
|
|
||||||
// progressBar.setVisibility(View.VISIBLE);
|
|
||||||
// rightImageButton.setImageDrawable(getContextIcon(context,
|
|
||||||
// R.drawable.ic_action_remove_dark));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (rightButtonAction != RightButtonAction.UNKNOWN) {
|
if (rightButtonAction != RightButtonAction.UNKNOWN) {
|
||||||
|
|
|
@ -19,7 +19,9 @@ import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.WorldRegion;
|
import net.osmand.plus.WorldRegion;
|
||||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||||
|
import net.osmand.plus.download.BaseDownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
|
import net.osmand.plus.download.IndexItem;
|
||||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||||
|
|
||||||
|
@ -93,9 +95,13 @@ public class RegionItemsFragment extends OsmandExpandableListFragment {
|
||||||
((RegionDialogFragment) getParentFragment())
|
((RegionDialogFragment) getParentFragment())
|
||||||
.onRegionSelected(region.getRegionId());
|
.onRegionSelected(region.getRegionId());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else if (obj instanceof ItemsListBuilder.ResourceItem) {
|
||||||
return false;
|
IndexItem indexItem = ((ItemsListBuilder.ResourceItem) obj).getIndexItem();
|
||||||
|
((BaseDownloadActivity) getActivity())
|
||||||
|
.startDownload(indexItem);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expandAllGroups() {
|
private void expandAllGroups() {
|
||||||
|
@ -233,12 +239,6 @@ public class RegionItemsFragment extends OsmandExpandableListFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedValue typedValue = new TypedValue();
|
|
||||||
Resources.Theme theme = getActivity().getTheme();
|
|
||||||
theme.resolveAttribute(R.attr.bg_color, typedValue, true);
|
|
||||||
int mainBackgroundColor = typedValue.resourceId;
|
|
||||||
convertView.setBackgroundResource(mainBackgroundColor);
|
|
||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,12 +251,6 @@ public class WorldItemsFragment extends OsmandExpandableListFragment {
|
||||||
viewHolder.textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
|
viewHolder.textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
|
||||||
viewHolder.textView.setText(item.getName());
|
viewHolder.textView.setText(item.getName());
|
||||||
|
|
||||||
TypedValue typedValue = new TypedValue();
|
|
||||||
Resources.Theme theme = getActivity().getTheme();
|
|
||||||
theme.resolveAttribute(R.attr.bg_color, typedValue, true);
|
|
||||||
int mainBackgroundColor = typedValue.resourceId;
|
|
||||||
convertView.setBackgroundResource(mainBackgroundColor);
|
|
||||||
|
|
||||||
} else if (groupPosition == worldMapsIndex) {
|
} else if (groupPosition == worldMapsIndex) {
|
||||||
ItemsListBuilder.ResourceItem item = (ItemsListBuilder.ResourceItem) child;
|
ItemsListBuilder.ResourceItem item = (ItemsListBuilder.ResourceItem) child;
|
||||||
ItemViewHolder viewHolder;
|
ItemViewHolder viewHolder;
|
||||||
|
@ -272,7 +266,6 @@ public class WorldItemsFragment extends OsmandExpandableListFragment {
|
||||||
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
viewHolder.setNauticalPluginDisabled(nauticalPluginDisabled);
|
||||||
viewHolder.setFreeVersion(freeVersion);
|
viewHolder.setFreeVersion(freeVersion);
|
||||||
viewHolder.bindIndexItem(item.getIndexItem(), getDownloadActivity(), false, false);
|
viewHolder.bindIndexItem(item.getIndexItem(), getDownloadActivity(), false, false);
|
||||||
|
|
||||||
} else if (groupPosition == voicePromptsIndex) {
|
} else if (groupPosition == voicePromptsIndex) {
|
||||||
String item = (String)child;
|
String item = (String)child;
|
||||||
SimpleViewHolder viewHolder;
|
SimpleViewHolder viewHolder;
|
||||||
|
|
Loading…
Reference in a new issue