Styled downloads view
This commit is contained in:
parent
d1aaa40582
commit
ccbb4e2625
6 changed files with 116 additions and 106 deletions
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
<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>
|
||||
|
||||
<!-- TextSizes -->
|
||||
<dimen name="list_header_text_size">14sp</dimen>
|
||||
|
|
|
@ -288,7 +288,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
setListAdapter(amenityAdapter);
|
||||
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
Drawable arrowImage = getResources().getDrawable(R.drawable.ic_destination_arrow);
|
||||
Drawable arrowImage = getResources().getDrawable(R.drawable.ic_destination_arrow_white);
|
||||
if (light) {
|
||||
arrowImage.setColorFilter(getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
} else {
|
||||
|
@ -796,7 +796,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
}
|
||||
}
|
||||
if(loc != null){
|
||||
DirectionDrawable draw = new DirectionDrawable(SearchPOIActivity.this, width, height, R.drawable.ic_destination_arrow);
|
||||
DirectionDrawable draw = new DirectionDrawable(SearchPOIActivity.this, width, height, R.drawable.ic_destination_arrow_white);
|
||||
Float h = heading;
|
||||
float a = h != null ? h : 0;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue